I could use some advice on how to handle error returns. The translate routine wants to return a hash reference containing information about the logical. If the logical isn't defined or some other error returns, I'm setting it up to return a scalar containing the status code. Does this sound usable? Should it return undef on error and provide another routine to get the status code?
The define routine and the create_table routine (working on it tonight) have a couple of things they could return. The status code is one since it could contain meaningful information even if the routine succeeded (alternate success codes). They could also get the actual name of the logical (or table) returned by the system service call. Any idea how both the status and return string could be made available by these routines? I'm kind of thinking along the lines of a translation object. Much of it could be implemented in perl on top of the XS code. The object could retain the status code so that the routines could return the other values or undef on error. $lnm = VMS::Logical->new; $result = $lnm->translate(...); if (!defined($result)) { print "Can't translate logical: ",$lnm->error; } @equivs = $lnm->as_strings(); $equiv = $lnm->as_string(); What should translate return? The hash as created by the current code? The translation string[s]?