diff options
author | Karl Williamson <khw@cpan.org> | 2015-03-17 15:44:03 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2015-03-18 09:44:16 -0600 |
commit | b8cae652c696ff805cc1c46872c4aa89444dd1e8 (patch) | |
tree | 4adcda6107ba89f9de95feb8259fb6fb788edeae /dist | |
parent | 49c4aee9770d41c2fd7866800ef51cfa28e02b58 (diff) | |
download | perl-b8cae652c696ff805cc1c46872c4aa89444dd1e8.tar.gz |
PATCH: [perl #124091] PP Data::Dumper fails on \n isolate
Commit 31ac59b61698e704b64192de74793793f4b5b0c0 inadvertently changed
the behavior of the pure perl version of Data::Dumper. If a newline is
the sole character in something being dumped with useqq, it no longer
got translated into a \n sequence and was output raw. This was due to
the regex matching of \n at beginning and ends of strings.
Diffstat (limited to 'dist')
-rw-r--r-- | dist/Data-Dumper/Dumper.pm | 2 | ||||
-rw-r--r-- | dist/Data-Dumper/t/dumper.t | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/dist/Data-Dumper/Dumper.pm b/dist/Data-Dumper/Dumper.pm index 0ea2e77d43..e884298d74 100644 --- a/dist/Data-Dumper/Dumper.pm +++ b/dist/Data-Dumper/Dumper.pm @@ -761,7 +761,7 @@ sub qquote { # this. || (! $IS_ASCII && $] ge 5.008_001 && utf8::is_utf8($_)); - return qq("$_") if / ^ [[:print:]]* $ /x; # fast exit + return qq("$_") unless /[[:^print:]]/; # fast exit if only printables # Here, there is at least one non-printable to output. First, translate the # escapes. diff --git a/dist/Data-Dumper/t/dumper.t b/dist/Data-Dumper/t/dumper.t index fa3ce97f5b..14f92dd949 100644 --- a/dist/Data-Dumper/t/dumper.t +++ b/dist/Data-Dumper/t/dumper.t @@ -108,7 +108,7 @@ sub SKIP_TEST { ++$TNUM; print "ok $TNUM # skip $reason\n"; } -$TMAX = 444; +$TMAX = 450; # Force Data::Dumper::Dump to use perl. We test Dumpxs explicitly by calling # it direct. Out here it lets us knobble the next if to test that the perl @@ -1746,3 +1746,12 @@ EOT TEST (q(Data::Dumper::DumperX($foo)), 'EBCDIC outlier control: DumperX') if $XS; } } +############# [perl #124091] +{ + $WANT = <<'EOT'; +#$VAR1 = "\n"; +EOT + local $Data::Dumper::Useqq = 1; + TEST (qq(Dumper("\n")), '\n alone'); + TEST (qq(Data::Dumper::DumperX("\n")), '\n alone') if $XS; +} |