The stupid question is the question not asked | |
PerlMonks |
Re: How to determine current line executing in Scriptby Anonymous Monk |
on Dec 04, 2008 at 12:56 UTC ( [id://727957]=note: print w/replies, xml ) | Need Help?? |
Make use of warn, $SIG{__WARN__} and END {...}. If the argument to warn doesn't end with a new line ( warn $x." "; ) then the line number will be appended. In $SIG{__WARN__} do a "push(@log,"@_");". In the END block print @log.
You probably should add a $SIG{__DIE__} where you also do the "push(@log ..." before you re-raise the die. That way you'll get a log if you "die".
In Section
Seekers of Perl Wisdom
|
|