From: Aaron Crane Date: Sun, 13 Jan 2013 10:08:02 +0000 (+0000) Subject: Make Data::Dumper XS ignore Freezer return value X-Git-Tag: upstream/5.20.0~4220 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=be022d23b5dec6da05d4e0b83699b87d88e8e3aa;p=platform%2Fupstream%2Fperl.git Make Data::Dumper XS ignore Freezer return value Fixes RT #116364 --- diff --git a/dist/Data-Dumper/Dumper.pm b/dist/Data-Dumper/Dumper.pm index 4fefb72..8c8ae7e 100644 --- a/dist/Data-Dumper/Dumper.pm +++ b/dist/Data-Dumper/Dumper.pm @@ -10,7 +10,7 @@ package Data::Dumper; BEGIN { - $VERSION = '2.140'; # Don't forget to set version and release + $VERSION = '2.141'; # Don't forget to set version and release } # date in POD below! #$| = 1; @@ -1359,7 +1359,7 @@ modify it under the same terms as Perl itself. =head1 VERSION -Version 2.140 (December 30 2012) +Version 2.141 (January 13 2013) =head1 SEE ALSO diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs index d7204e1..d0f7145 100644 --- a/dist/Data-Dumper/Dumper.xs +++ b/dist/Data-Dumper/Dumper.xs @@ -344,7 +344,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv, { dSP; ENTER; SAVETMPS; PUSHMARK(sp); XPUSHs(val); PUTBACK; - i = perl_call_method(SvPVX_const(freezer), G_EVAL|G_VOID); + i = perl_call_method(SvPVX_const(freezer), G_EVAL|G_VOID|G_DISCARD); SPAGAIN; if (SvTRUE(ERRSV)) warn("WARNING(Freezer method call failed): %"SVf"", ERRSV); diff --git a/dist/Data-Dumper/t/freezer.t b/dist/Data-Dumper/t/freezer.t index c46d861..a67cc12 100644 --- a/dist/Data-Dumper/t/freezer.t +++ b/dist/Data-Dumper/t/freezer.t @@ -25,6 +25,11 @@ ok($dumped_foo, like($dumped_foo, qr/frozed/, "Dumped string has the key added by Freezer."); +# test that list-context freeze return doesn't contain the freezer's return +# value; RT #116364 +like(join(" ", Dumper($foo)), qr/\A\$VAR1 = /, + "Dumped list doesn't begin with Freezer's return value"); + # run the same tests with useperl. this always worked { local $Data::Dumper::Useperl = 1; @@ -34,6 +39,8 @@ like($dumped_foo, qr/frozed/, "Use of freezer sub which returns non-ref worked with useperl"); like($dumped_foo, qr/frozed/, "Dumped string has the key added by Freezer with useperl."); + like(join(" ", Dumper($foo)), qr/\A\$VAR1 = /, + "Dumped list doesn't begin with Freezer's return value with useperl"); } # test for warning when an object doesn't have a freeze()