Devel::...Extract(3)
π¦ Devel::StackTrace::Extract π¦
okay so bestie, welcome to this User Contributed Perl Documentation page β page tag Devel::...Extract(3), and the vibe is making stack-trace extraction from exception objects make sense π
β¨ NAME β¨
Devel::StackTrace::Extract β Extract a stack trace from an exception object
π VERSION π
version 1.000000
πΈ DESCRIPTION πΈ
okay so storing stack traces inside objects that get thrown as exceptions? Super popular, no cap. But this being Perl, thereβs more than one way to do it π. This module gives you a simple interface that attempts to extract the stack trace from various well-known exception classes that are on the CPAN. Itβs giving βone little helper, many exception flavorsβ π«Ά.
π«Ά FUNCTION π«Ά
Exported on demand or can be used fully qualified.
π extract_stack_trace($exception_object) π
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):
- If it has a method called
stack_trace, use that β This works with anything that uses theStackTrace::AutoMoose/Moo role, or subclasses theThrowable::Exceptionclass. - If it is a
Mojo::Exception, and has a method calledframes, use that β If we have a modernMojo::Exceptionobject with aframesmethod, and it has its frames populated (i.e. someone used thetracemethod, or calledthrow), then weβll synthesize aDevel::StackTraceinstance from that. - If it has a
tracemethod, call that β This works forException::Classbuilt exception objects, as well as anyMoose::Exceptioninstances.
π BUGS π
- The heuristics in this make no attempt to check whatever is returned by the exception classes are valid
Devel::StackTraceobjects. Mojo::Exceptionobjects donβt keep track of the arguments that are passed to a stack frame, so theDevel::StackTracethat this synthesizes acts as if every subroutine was called without arguments.
π SEE ALSO π
Devel::StackTraceThrowable::ErrorandStackTrace::AutoException::ClassMoose::ExceptionMojo::Exception
π AUTHOR π
Mark Fowler <mfowler@maxmind.com>
π« CONTRIBUTORS π«
Dave Rolsky <drolsky@maxmind.com>Mark Fowler <mark@twoshortplanks.com>Olaf Alders <oalders@maxmind.com>
π COPYRIGHT AND LICENSE π
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.
later bestie π«Άβ¨ β signing off from perl v5.32.1, dated 2025-01-18, with the page tag Devel::...Extract(3) π
π¦ where this page comes from
- epel 9: perl-Devel-StackTrace-Extract 1.000000-8.el9 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms