Posted on 2006-03-22 00:59:37-08 by jdhedden in response to 2001
Re: Dynamic way to get specific exception name from object?
You can use the 'caught' method with your base class (which defaults to Exception::Class::Base), and then use 'ref' on the caught exception.
eval { ... }; if (my $e = Exception::Class::Base->caught()) { print(STDERR "Caught an exception of type ", ref($e), "\n"); }
Direct Responses: 2004 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.