This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Inline Devel::Peek::Dump; allow Dump %hash etc.
authorFather Chrysostomos <sprout@cpan.org>
Mon, 12 Aug 2013 04:54:11 +0000 (21:54 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 13 Aug 2013 20:42:40 +0000 (13:42 -0700)
commit34b94bc4d14e09f43028265cf501a750754f844c
treecf3e5c253effa3365e2d28e7156946f6ad3a42c8
parentec2a15bbde2590124a10c9ae5b07794eeabcdcbe
Inline Devel::Peek::Dump; allow Dump %hash etc.

This commit makes Devel::Peek::Dump modify the op tree to allow it to
dump arrays and hashes directly via Dump @array and Dump %hash.  It
also puts other operators in rvalue context, allowing the return value
of rvalue substr for instance to be dumped, making Devel::Peek more
useful as a debugging tool.

Since a future commit (to fix the rest of #78194) is likely to make
pp_entersub copy PADTMPs (operator return values) for XSUBs (it
already happens for Perl subs as of b479c9f2a), to the detriment of
Devel::Peek’s usefulness, I also made it inline Dump as a custom op.

This does introduce a backward-incompatible change, in that both argu-
ments to Dump are now in scalar context, and the number of arguments
is checked at compile time instead of run time (still run time for
&Dump(...)), but I think it is worth it.
ext/Devel-Peek/Peek.xs
ext/Devel-Peek/t/Peek.t