in reply to Debugging My Perl
How about putting this near the top of your script:
BEGIN { open OLDERR, '>&STDERR' or die "Couldn't dupe STDERR.\n$!";; open STDERR, '>>', 'errors.log' or die "Couldn't redirect STDERR.\n$!"; print STDERR 'Starting run of $0 at ', scalar localtime, ", with parameters: @ARGV\n"; }
Now OLDERR will preserve the original STDERR (for possible later use). And STDERR itself will be redirected to a file named 'errors.log'. I'm opening 'errors.log' in append mode, and prefacing each run with a timestamp. If you prefer standard write mode, use '>' instead of '>>'.
That way, you'll be able to view errors.log with a regular text editor, or even a browser, which should solve the scrolling problem for you. Remember to remove this code, or disable it when the script is done being debugged. You don't want your errors.log file growing gigantic as a new entry is created in the file each time the script is run.
Dave
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Debugging My Perl
by Spidy (Chaplain) on Sep 06, 2004 at 06:01 UTC |