Tom, WC:

Thanks!

This works (almost) perfectly.

I issued the

open $DB::OUT, "| tee dbug.txt" 

as a Perl Debugger command. The output is a little funky when displaying
Perl debugger keyboard commands entered by the user, but the output
produced by the Perl debugger is captured faithfully in the output file.

It is really nice to have the brainpower of this reflector to answer
questions like this!

thanks again,
Gavin

sample keyboard session output follows:

bash-2.05b$ perl -d test.pl

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

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

main::(test.pl:3):      $x = 1;
  DB<1> open $DB::OUT, "| tee dbug.txt"

  DB<2> s
main::(test.pl:4):      print "x:$x\n";
  DB<2> p $x
1
  DB<3> q
bash-2.05b$ ls -ralt
...
total 8272
-rw-rw-r--    1 gbowlby  isp           113 Jul 12 15:28 dbug.txt
bash-2.05b$ cat dbug.txt

  DB<2> main::(test.pl:4):      print "x:$x\n";
  DB<2> 1       <===== <This is the output of the debugger p $x command.
bash-2.05b$

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Tom Phoenix
Sent: Wednesday, July 12, 2006 12:11 PM
To: Gavin Bowlby
Cc: perl beginners
Subject: Re: question on redirecting output of Perl debugger commands

On 7/12/06, Gavin Bowlby <[EMAIL PROTECTED]> wrote:

> I would like to see the results of the Perl debugging session in a
file.

The debugger wasn't made with that in mind, but you could work around
it. At least, this works for me.

  open $DB::OUT, "| tee dbug.txt" or die if $DB::OUT;

You may find some escape sequences in the output. Some would call that
a feature.

If using that line early in your code (or as a debugger command) isn't
soon enough to catch what you need, you could wrap it in a BEGIN
block. If the BEGIN block doesn't make it execute soon enough, you can
hack a copy of perl5db.pl to start the tee as the debugger starts up;
see the perldebug manpage.

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to