|
|
| We don't bite newbies here... much | |
| PerlMonks |
Re^7: Use of "die" in OO modulesby adrianh (Chancellor) |
| on Jan 28, 2007 at 21:31 UTC ( #596990=note: print w/ replies, xml ) | Need Help?? |
|
Are you saying that if I eval { die MyExceptionClass->new(...) }; that the $@ variable will contain the instance of MyExceptionClass? Exactly ;-) From perldoc die: die() can also be called with a reference argument. If this happens to be trapped within an eval(), $@ contains the reference. This behavior permits a more elaborate exception handling implementation using objects that maintain arbitrary state about the nature of the exception. Such a scheme is sometimes preferable to matching particular string values of $@ using regular expressions.
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||