in reply to Re: Am I missing something here?
in thread Am I missing something here?
Then I make a debug subroutine:$debug = 1;
Then throughout the code, I drop in things like:sub Debug { if ( $debug ) { my $msg = shift; print $msg, "\n"; } }
This allows me to check values of just about anything, at any point in execution. Then when you're done debugging, you just set $debug to zero and you're done. Personally, I usually leave the debug code in place, in case I ever need to come back and fiddle with the program and need to debug it again.Debug( "Entering calculation phase." ); Debug( "Pre-calculation value of \$x: $x" ); ... Debug( "Leaving calculation phase." ); Debug( "Post-calculation value of \$x: $x" );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Am I missing something here?
by Biker (Priest) on Nov 07, 2001 at 20:05 UTC | |
by lestrrat (Deacon) on Nov 08, 2001 at 23:09 UTC | |
by Biker (Priest) on Nov 09, 2001 at 01:18 UTC | |
by blakem (Monsignor) on Nov 08, 2001 at 00:47 UTC | |
by Biker (Priest) on Nov 08, 2001 at 01:44 UTC | |
by suggus (Sexton) on Nov 08, 2001 at 02:15 UTC |