I have a question about how to protect against indirection errors.

Imagine this function

MyFunct(pRef)
   new result
   set result=$get(@pRef)
   quit result


Here are some possible inputs and results:

     pRef
     Input                Output
     ------                 ----------
#1 ^VA(200,1,0)   IRM,[EMAIL PROTECTED]
#2 ^VA(200,1)      ""
#3 ^VA(200,,0)    <----- causes error.

In entry #2:  if the data does not exist, then $get() protects against
a crash and returns a "" value.
But in entry #3, the indirection variable is invalid and causes an error.

Is there anyway for a function to protect itself against invalid
indirection errors, short of setting up an error trap?  I can't think
of any reasonable way to try to validate input values other than
perhaps a simple test to ensure pRef'="" (which would only catch one
possible error).

Thanks
Kevin


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
Hardhats-members mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hardhats-members

Reply via email to