in reply to How to track variable usage in a script?
perldebug. However you may find it easier to add code in the form:
my $DEBUG = 0; # set to > 0 for debugging, the bigger the value the +more verbose # in the code wherever you think it useful $DEBUG && DEBUG( 2, "some message" ); sub DEBUG { my ( $debug_level, $message ) = @_; # see if we want this message a current debug level return if $debug_level > $DEBUG; # we can get info on where this info comes from from caller() my ( $package, $file, $line ) = caller(); # print a standard format message, say line num and message warn "$line\t\$message\n"; }
This is one of many ways to incorporate debugging. Just call the DEBUG function with an int first argument and a message. Set the debug level and get more verbose output. The $DEBUG && DEBUG( ... ) suntax is to avoid the sub call if we are not debugging.
cheers
tachyon
|
|---|