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


In reply to Re: Debugging My Perl by davido
in thread Debugging My Perl by Spidy

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.