1Devel::StackTrace::ExtrUascetr(3C)ontributed Perl DocumeDnetvaetli:o:nStackTrace::Extract(3)
2
3
4
6 Devel::StackTrace::Extract - Extract a stack trace from an exception
7 object
8
10 version 1.000000
11
13 It's popular to store stack traces in objects that are thrown as
14 exceptions, but, this being Perl, there's more than one way to do it.
15 This module provides a simple interface to attempt to extract the stack
16 trace from various well known exception classes that are on the CPAN.
17
19 Exported on demand or can be used fully qualified
20
21 extract_stack_trace($exception_object)
22 Returns a Devel::StackTrace stack trace object extracted from the
23 exception object or returns undef if no stack trace can be extracted
24 with the current heuristics.
25
26 The current rules that this uses to determine how to get a stack trace
27 are, in order, as follows (these are subject to change without notice):
28
29 If it has a method called "stack_trace" use that
30 This works with anything that uses the StackTrace::Auto Moose/Moo
31 role, or subclasses the Throwable::Exception class.
32
33 If it is a Mojo::Exception, and has a method called "frames" use that
34 If we have a modern Mojo::Exception object with a "frames" method,
35 and it has its frames populated (i.e. someone used the "trace"
36 method, or called "throw") then we'll synthesize a
37 Devel::StackTrace instance from that.
38
39 If it has a "trace" method call that
40 This works for Exception::Class built exception objects, as well as
41 any Moose::Exception instances.
42
44 The heuristics in this make no attempt to check whatever is returned by
45 the exception classes are valid Devel::StackTrace objects
46
47 Mojo::Exception objects don't keep track of the arguments that are
48 passed to a stack frame, so the Devel::StackTrace that this synthesizes
49 acts as if every subroutine was called without arguments.
50
52 Devel::StackTrace
53
54 Throwable::Error and StackTrace::Auto
55
56 Exception::Class
57
58 Moose::Exception
59
60 Mojo::Exception
61
63 Mark Fowler <mfowler@maxmind.com>
64
66 • Dave Rolsky <drolsky@maxmind.com>
67
68 • Mark Fowler <mark@twoshortplanks.com>
69
70 • Olaf Alders <oalders@maxmind.com>
71
73 This software is copyright (c) 2016 by MaxMind, Inc.
74
75 This is free software; you can redistribute it and/or modify it under
76 the same terms as the Perl 5 programming language system itself.
77
78
79
80perl v5.38.0 2023-07-20 Devel::StackTrace::Extract(3)