![]() |
|
go ahead... be a heretic | |
PerlMonks |
Re: Exceptions and Return Codesby merlyn (Sage) |
on Jun 29, 2001 at 17:45 UTC ( #92608=note: print w/replies, xml ) | Need Help?? |
If a failure is a "normal" thing, a special return value is fine.
If a failure is an "exceptional" thing, I'd prefer a death that I can catch. If extra information needs to be provided, I'd prefer a package-specific global, or (using recent Perl exceptions that can handle die $object), a death object which can be queried. So there's no one "right answer". It really depends on how frequent and how complex the failure can get. And as long as I'm on the soapbox, the wrong answer is "put it into $@", as some of the IO::* does. That's reserved for an eval failure, Graham. Usurping that was a bad idea. Bleh. -- Randal L. Schwartz, Perl hacker
In Section
Seekers of Perl Wisdom
|
|