What’s the programmatic equivalent of the perl debugger’s x command?
IOW, what’s the function x such that the line
print x( $myvar );
in a Perl script will result in output with the same format as that produced by
DB<2> x $myvar
in the perl debugger?
(NOTE: I’m aware of Data::Dumper, and it is not what I’m looking for; IOW, I’m explicitly ruling it out; D::D‘s formatting differs from that produced by the debugger’s x, and I prefer the latter.)
I believe you are looking for the routines in
dumpvar.pl, which you will find in the same directory as yourperl5db.plfile (cf.perldoc -l perl5db.pl).Example:
Produces: