in reply to dying() more informatively

I believe what you are looking for is caller. For deep debugging, I use the following die replacement:
sub DIE { my $i=0; while (my @info=caller($i++)) { print STDERR "$info[3]($info[2]) "; } print STDERR ": "; printf STDERR @_; print STDERR "\n"; exit 1; }
which when used, produces output like
main::DIE(16) main::foo(19) main::ack(22) main::bar(25) : HI
when run via
sub foo { DIE "HI"; } sub ack { foo; } sub bar { ack; } bar();

Update: I should make it clear, I don't intend for this to be a direct replacement for die in any way. I meant to imply that I stick it into code (and a comparible WARN routine) for debugging purposes only.

If you wanted a caller output and then a normal die, I would suggest something like (untested):

sub DIE { my $i=0; my $buff; while (my @info=caller($i++)) { $buff.="$info[3]($info[2]) "; } die $buff; }
or using one of the other approaches suggested here :)

Replies are listed 'Best First'.
Re (tilly) 2: dying() more informatively
by tilly (Archbishop) on May 09, 2001 at 12:17 UTC
    Please, please, please check $^S if you are going to change the behaviour of die like this. You have no idea what libraries you will mutilate that use eval/die to catch normal exceptions in program flow (eg alarm timeouts) that don't want to be turned into an untrappable fatal error.
(tye)Re: dying() more informatively
by tye (Sage) on May 09, 2001 at 21:57 UTC

    Please build up a string and just redie with that string. Even better, use eval { ... } around the heart of your code instead. __DIE__ handlers have some bad design flaws and your code is exercising most of them.

    Sorry, I think tilly's reply fooled me. You aren't using a __DIE__ handler nor overriding die.

    <Emily Latela>Never mind</Emily Latela>

            - tye (but my friends call me "Tye")