Exception-Class - Re: Dynamic way to get specific exception name from object?

Posted on Wed Mar 22 02:59:37 2006 by jdhedden in response to 2001 (See the whole thread of 3)
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