Perl-Sensitive Sunglasses | |
PerlMonks |
Re: Handling non-fatal method error strings without exceptions or globals?by demerphq (Chancellor) |
on Jan 19, 2005 at 17:58 UTC ( [id://423455]=note: print w/replies, xml ) | Need Help?? |
You could use dualvar and a hash...
Of course this still leaves the problem of where to put the error, in the return or in a global. I think your options range from using something like $Pack::Error (which is IMO infinitely preferable to using the magic global $_), using $@ or using something like ${^MYERROR}. For instance I think the following is a reasonable approach:
Assuming that you dont have any eval checking logic that this will interfere with (and im not seeing immediately how that could happen anyway) then it should be ok.
--- demerphq
In Section
Seekers of Perl Wisdom
|
|