See perldoc caller for explanation. (I seem to recall there may be times when $^S is inaccurate; if so, just use die @_ if in_eval.)sub in_eval { my $i=0; while (my @caller=caller($i++)) { return defined $caller[6] ? "eval EXPR" : "eval BLOCK" if !$caller[7] && $caller[3] eq "(eval)" } } ... die @_ if defined $^S ? $^S : in_eval;
In reply to Re: BEGIN, eval {} and $^S
by ysth
in thread BEGIN, eval {} and $^S
by eclark
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |