This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
prevent failures deep in value dumping from aborting
authorRicardo Signes <rjbs@cpan.org>
Fri, 25 Jan 2013 03:44:22 +0000 (22:44 -0500)
committerRicardo Signes <rjbs@cpan.org>
Sat, 26 Jan 2013 04:32:53 +0000 (23:32 -0500)
commit0d0268b0705058782fcff32c6184f87f39b5ae3b
tree2034fb8c2b4a9a791841e5498f81ae46ba63c03a
parent58cbf594161fa4470048f84f26076c4a69ba49d2
prevent failures deep in value dumping from aborting

Sometimes, dumpvar's dumpvalue routine gets a value it can't dump.  The
simplest example to contrive is the one in this test: a tied hash that
can't tell you its keys.  Until now, this would cause the whole dump to
abort as soon as it failed to dump one part.

With this commit, each stringify or unwind is inside an eval.  Failed
stringifications or unwindings are replaced with a placeholder showing
the error.

unwind uses return to stop early, and rather than go through contortions
to wrap the eval in something that can then return 1 to test that eval
worked, I've just asserted that this code requires 5.14.0, which made $@
a much more reliable indicator of failure after eval.
lib/dumpvar.pl
lib/dumpvar.t