Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: Debugging a program

by perrin (Chancellor)
on Aug 06, 2008 at 16:52 UTC ( #702681=note: print w/ replies, xml ) Need Help??


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

You could just run your code in the debugger and do this when you find a warning you want to stop on:

$DB::single = 1;


Comment on Re^2: Debugging a program
Download Code
Re^3: Debugging a program
by hexcoder (Hermit) on Aug 06, 2008 at 17:22 UTC
    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; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2014-08-30 00:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (289 votes), past polls