Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^3: Debugging a program

by hexcoder (Hermit)
on Aug 06, 2008 at 17:22 UTC ( #702691=note: print w/ replies, xml ) Need Help??

in reply to Re^2: Debugging a program
in thread Debugging a program

Thanks, that saves the action of setting a breakpoint.

But even better, I could shift the signal handler code into the debugger initialization file .perldb. Then I do not have to modify the original source code. Works great!

This is the content of file .perldb (place it in the current or in the home directory):

sub afterinit { $::SIG{'__WARN__'} = sub { my $warning = shift; if ( $warning =~ m{\s at \s \S+ \s line \s \d+ \. $}xms ) { $DB::single = 1; # debugger stops here automatically } warn $warning; }; print "sigwarn handler installed!\n"; return; }

Comment on Re^3: Debugging a program
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://702691]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2015-10-04 17:43 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (103 votes), past polls