Skip to content


Subversion checkout URL

You can clone with
Download ZIP


wishlist: add Devel::Peek::Dump() support #13

dagolden opened this Issue · 5 comments

2 participants


much like disassembling, it would be nice to be able to Dump variables


Thanks for the suggestion!

In commit 8fe1580 this is added under the name "info variables dump". There are already other "info variables" commands. I would like to do more on validity checking of the variable name argument, but I don't know to what extent that can be done. I don't know Devel::Peek that well, should more features be offered?

I am happy that Devel::Peek is part of Perl. I'm not happy that Devel::Peek::Dump uses print to output rather provide an interface to return a string or list of strings. Down the line I'll have to save/restore STDOUT to capture print output to a string.

Some side comments. Look at the commit for how easy it was to hack this in, although it is probably not complete and I should add a test.

commit 21f5bba fixes the help string for the "finish" command that I noticed in the demo. Again, thanks for the work and organizing this meetup.

@rocky rocky referenced this issue from a commit
rocky Add 'Devel::Peek::Dump output under the name "info var dump". Issue #13.
Thanks (again) to David Golden and

I have not been successful in using Capture::Tiny here. It redirects output, but in the process the eval environment is not what is needed. The whole eval in the DB package is really fragile if not also ugly and contorting. For now, there is an "eval-print-save" branch that has this code, but in master, I've disabled this.

Of course running:

eval Devel::Peek::Dump(\$var); 

works if you want the output to go to STDERR. In general though, this is not what is always desired.

I'll also try to work up a patch for Devel/Peek.xs to add an optional filehandle parameter. Looking at the existing code, that seems the least invasive and backward compatible.


Ok. Done. Will wait on resolution there on Devel::Peek before adding a command.

Another thing you can do in the meantime is add a macro for this. In .treplrc:

eval use Devel::Peek
macro dump sub{ [ 'eval Devel::Peek::Dump(\\' . (shift) . ')'] }

With this, dump @ARGV will expand to eval Devel::Peek::Dump(\@ARGV)

But if you do this, be aware that there was a bug in handling macro parameters that was just fixed 2ccb9c1 . Version 0.34 will have this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.