Devel::StackTrace::Extract - Extract a stack trace from an exception object
version 1.000000
It's popular to store stack traces in objects that are thrown as exceptions, but, this being Perl, there's more than one way to do it. This module provides a simple interface to attempt to extract the stack trace from various well known exception classes that are on the CPAN.
Exported on demand or can be used fully qualified
Returns a Devel::StackTrace stack trace object extracted from the exception object or returns undef if no stack trace can be extracted with the current heuristics.
The current rules that this uses to determine how to get a stack trace are, in order, as follows (these are subject to change without notice):
stack_trace
This works with anything that uses the StackTrace::Auto Moose/Moo role, or subclasses the Throwable::Exception class.
frames
If we have a modern Mojo::Exception object with a frames method, and it has its frames populated (i.e. someone used the trace method, or called throw) then we'll synthesize a Devel::StackTrace instance from that.
trace
throw
This works for Exception::Class built exception objects, as well as any Moose::Exception instances.
The heuristics in this make no attempt to check whatever is returned by the exception classes are valid Devel::StackTrace objects
Mojo::Exception objects don't keep track of the arguments that are passed to a stack frame, so the Devel::StackTrace that this synthesizes acts as if every subroutine was called without arguments.
Devel::StackTrace
Throwable::Error and StackTrace::Auto
Exception::Class
Moose::Exception
Mojo::Exception
Mark Fowler <mfowler@maxmind.com>
Dave Rolsky <drolsky@maxmind.com>
Mark Fowler <mark@twoshortplanks.com>
Olaf Alders <oalders@maxmind.com>
This software is copyright (c) 2016 by MaxMind, Inc.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Devel::StackTrace::Extract, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Devel::StackTrace::Extract
CPAN shell
perl -MCPAN -e shell install Devel::StackTrace::Extract
For more information on module installation, please visit the detailed CPAN module installation guide.