in reply to dying() more informatively
which when used, produces output likesub DIE { my $i=0; while (my @info=caller($i++)) { print STDERR "$info[3]($info[2]) "; } print STDERR ": "; printf STDERR @_; print STDERR "\n"; exit 1; }
when run viamain::DIE(16) main::foo(19) main::ack(22) main::bar(25) : HI
sub foo { DIE "HI"; } sub ack { foo; } sub bar { ack; } bar();
If you wanted a caller output and then a normal die, I would suggest something like (untested):
or using one of the other approaches suggested here :)sub DIE { my $i=0; my $buff; while (my @info=caller($i++)) { $buff.="$info[3]($info[2]) "; } die $buff; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 2: dying() more informatively
by tilly (Archbishop) on May 09, 2001 at 12:17 UTC | |
|
(tye)Re: dying() more informatively
by tye (Sage) on May 09, 2001 at 21:57 UTC |