The eval number changes quite often, but not the line number, so I thnk that means the same line of the same eval'ed code is failing.Probably, yes.
How do I track down where the eval is happening?You can use one of the routines from Carp which produce a stack trace. Attach either confess() or cluck() to $SIG{__WARN__} — the latter is fatal, the former a warning.
#!perl -w use Carp; local $SIG{__WARN__} = \&Carp::cluck; sub foo { my($x, $y) = @_; return eval '$x+$y'; } print foo(5); # should get 2 arguments;
Use of uninitialized value in addition (+) at (eval 1) line 1. eval '$x+$y ;' called at test.pl line 6 main::foo(5) called at test.pl line 8 5
p.s. For some reason unclear to me, I get no output using \&Carp::confess. Any hints on why are welcomed.
In reply to Re: tracing eval
by bart
in thread tracing eval
by leriksen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |