I just figured out something I wanted for quite some time but never knew how to do and that is how to output stuff from a debugger-session into a file.

The use-case is the following: You debug a script and inspect a large data-structure via x $huge_reference.
Unfortunately this is really big and you would like to inspect it more closely in an editor, so you need to dump the structure into a file...

This is how to do it in the debugger:

First set up a pager like this: o pager=">my_file"
Then pipe the x-command through the pager like this: |x $huge_reference

That's it - "my_file" now contains the dump for you to inspect.

You can even set up a pager as ">>my_file" for appending.

I apologize for setting this up as a meditation as it may be common knowledge among Perl-hackers but it was new to me and I hope it might be useful for someone else as well.

Comment on output to a file from the debugger
Select or Download Code
Re: output to a file from the debugger
by Anonymous Monk on Jul 25, 2012 at 02:49 UTC