On Fri, 1 Dec 2000 14:35:43 -0800, Eric Brown
<[EMAIL PROTECTED]> wrote:
>How can you get the output from a perl debugger command to be redirected
to
>a file?
>I'm trying to debug a sizable perl program that uses a largish tree
>structure.  When I use the 'p' command, I get HASH(0x203f87c).  If I use
the
>'x' command, I get several hundred screens of output, as it dumps this
>*huge* data structure.  The HashDepth and ArrayDepth options either give
me
>too little info or way too much info.  If I could redirect the output to
a
>file, I'd be able to look at the data structures with fewer problems,
but I
>can't figure out how to do that.
> 
>Using the 'x' command doesn't work right, either.
> 
>Eric

Hi Eric,

It can be done with perldb, but have you considered using
Devel::ptkdb? Devel::ptkdb gives you a nice, graphical, debug
environment. I just created a hash with 10 000 elements and
the debugger happily displayed it in the expressions window.
I could scroll from beginning to end.

As the name implies, Devel::ptkdb requires PerlTk. For me, it
was a good excuse to install Tk, which I was going to try anyway.

If you are determined to use perldb, here's how I would dump
%ENV to a file:

C:\My Documents\Perl\Test>perl -de 123
Default die handler restored.

Loading DB routines from perl5db.pl version 1.07
Editor support available.

Enter h or `h h' for help, or `perldoc perldebug' for more help.

main::(-e:1):   123
  DB<1> O pager='>dbg.txt'
               pager = '>dbg.txt'
  DB<2> |X ENV

or if you prefer to setup the file like a log file, use append mode:

  DB<3> O pager='>>dbg.txt'
               pager = '>>dbg.txt'
  DB<4> |X ENV

HTH,
Jonathan D Johnston
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activeperl

Reply via email to