In case you croak (or something else that produces a stacktrace) within the the found method e.g
use Carp 'croak';
sub exec_anon { &{$_[0]} }
sub boom { eval { croak "$_[0]\->boom" }; print "trace: $@" }
exec_anon sub { main->boom };
exec_anon sub { unshift @_, 'main'; goto &{main->can("boom")} };
__output__
trace: main->boom at - line 4
eval {...} called at - line 4
main::boom('main') called at - line 6
main::__ANON__ called at - line 3
main::exec_anon('CODE(0x8107e64)') called at - line 6
trace: main->boom at - line 4
eval {...} called at - line 4
main::boom called at - line 3
main::exec_anon('main', 'CODE(0x8117378)') called at - line 7
Not terrifically important, or necessarily desired, but it can be much easier to follow things if wrapper functions are hidden away and it's safer if you're dealing with code that looks up the stack (for whatever reason). Use with caution™.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link or
or How to display code and escape characters
are good places to start.
|