Two ideas that have not been mentioned (but may only work on Unix) are the following. You can prepend a pipe symbol | before debugger commands to get paged output. (I have heard that H. redmondiensis knows about the wheel and the inclined plane, so maybe he also knows about pagers.)

% perl -de 1 Loading DB routines from perl5db.pl version 1.23 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(-e:1): 1 DB<1> %hash = 1..100 DB<2> |x \%hash ~ ~ ~ 0 HASH(0x8447fb4) 1 => 2 11 => 12 13 => 14 15 => 16 17 => 18 19 => 20 21 => 22 23 => 24 25 => 26 27 => 28 29 => 30 3 => 4 31 => 32 33 => 34 35 => 36 37 => 38 39 => 40 41 => 42 43 => 44 39%

(Those squigglies before the paged output and the 39% at the bottom are courtesy of my default pager, /usr/bin/less.)

In fact, though this is the default behavior when one prepends a | to commands, you can customize this significantly, to tell the debugger where to send its output.

DB<3> o pager Option `pager' is non-boolean. Use `o pager=VAL' to set, `o pager?' t +o query DB<4> o pager? pager = '|/usr/bin/less' DB<5> o pager='>> /tmp/capture' pager = '>> /tmp/capture' DB<6> |x %hash DB<7> |X DB<8> o pager='|/usr/bin/less' pager = '|/usr/bin/less'

In <5> I change the pager option from its default '|$ENV{PAGER}' (where, in your typical halfway civilized Unix system, PAGER is an environment variable that holds one's default pager), to '>> /tmp/capture'. This means that the output of debugger commands prepended by | (in this case, those on <6> and <7>) will now be appended to the file /tmp/capture. In <8> I restore the original value of pager.

the lowliest monk


In reply to Re: How do I get output from the perl debugger (perl -d) into a text file? by tlm
in thread How do I get output from the perl debugger (perl -d) into a text file? by tphyahoo

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.