I\'m working in a large Perl application and would like to get stack traces every time \'die\' is called. I\'m aware of the Carp module, but I would prefer not to search/replace
The Error module will convert all die
s to Error::Simple
objects, which contain a full stacktrace (the constructor parses the "at file... line.." text and creates a stack trace). You can use an arbitrary object (generally subclassed from Error::Simple
) to handle errors with the $Error::ObjectifyCallback
preference.
This is especially handy if you commonly throw around exceptions of other types to signal other events, as then you just add a handler for Error::Simple
(or whatever other class you are using for errors) and have it dump its stacktrace or perform specialized logging depending on the type of error.