For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > April 2004 > Re: forcing stack backtrace in the case of unhandled exception/Perl









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: forcing stack backtrace in the case of unhandled exception/Perl
Randy W. Sims

2004-04-27, 12:26 am

On 4/26/2004 1:02 PM, David Garamond wrote:

> I've [re]discovered the wonderful world of Carp. I've now peppered most
> of my scripts with 'use Carp qw(verbose);'.
>
> However, whenever things go wrong (like my program calls an undefined
> subroutine, or I tried to modify a constant), my program dies without
> the stack backtrace. Any idea how I can get a backtrace?
>


$SIG{__WARN__} = sub {
# verbose output
}

$SIG{__DIE__} = sub {
# verbose output
}

perldoc perlvar


David Garamond

2004-04-27, 5:01 am

Randy W. Sims wrote:
> On 4/26/2004 1:02 PM, David Garamond wrote:
>
>
> $SIG{__WARN__} = sub {
> # verbose output
> }
>
> $SIG{__DIE__} = sub {
> # verbose output
> }
>
> perldoc perlvar


Thanks! I've forgotten all about warn and die handlers.

--
dave

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com