Posted on 2006-03-21 23:11:48-08 by cowanbill
Dynamic way to get specific exception name from object?
When catching an exception, the catch may be either the exception identified in the 'caught' method or a subclass. I would like to have a dynamic mechanism to get the actual class name for the exception object (e.g. "MyException::File::Open" subclass or "MyException::File"?). This would be useful in building diagnostic info to log or present to developer.

Suggestions for how to do this? Hopefully without hardcoding?

There are a several class and object methods described in the doc for Exception::Class. Available object method I missed?
Direct Responses: 2002 | 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.