In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/2a43599bfdf94948614424bc4fd8d6b65cf195ec?hp=09f8a1025e8fc99cd5cd3e8fb446079c5725e43c>
- Log ----------------------------------------------------------------- commit 2a43599bfdf94948614424bc4fd8d6b65cf195ec Author: Father Chrysostomos <[email protected]> Date: Sat Dec 6 06:15:40 2014 -0800 B::Deparse: Escape non-ASCII printable chars Before this, we were escaping all non-ASCII chars if the string con- tained any non-printable chars. So ".\x{100}" would come out exactly like that, but "\x{100}" would be deparsed as "Ä", causing problems if the script has no âuse utf8â in scope. (It was also misbehaving on EBCDIC, causing the existing \x test to fail.) M lib/B/Deparse.pm M lib/B/Deparse.t commit ea36157cfd55b065cc56d4a888b8bd539686a32e Author: Father Chrysostomos <[email protected]> Date: Sat Dec 6 06:01:03 2014 -0800 Deparse.pm: Donât call maybe_parens for sv_undef (LIST)[INDEX] is neat, but it doesnât short-circuit, so it should not be used if LIST contains method calls. M lib/B/Deparse.pm ----------------------------------------------------------------------- Summary of changes: lib/B/Deparse.pm | 5 +++-- lib/B/Deparse.t | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/B/Deparse.pm b/lib/B/Deparse.pm index 2b2ee12..d095914 100644 --- a/lib/B/Deparse.pm +++ b/lib/B/Deparse.pm @@ -4442,7 +4442,8 @@ sub const { } if (class($sv) eq "SPECIAL") { # sv_undef, sv_yes, sv_no - return ('undef', '1', $self->maybe_parens("!1", $cx, 21))[$$sv-1]; + return $$sv == 3 ? $self->maybe_parens("!1", $cx, 21) + : ('undef', '1')[$$sv-1]; } if (class($sv) eq "NULL") { return 'undef'; @@ -4545,7 +4546,7 @@ sub const { return $self->maybe_parens("\\$const", $cx, 20); } elsif ($sv->FLAGS & SVf_POK) { my $str = $sv->PV; - if ($str =~ /[[:^print:]]/) { + if ($str =~ /[[:^print:]]/a) { return single_delim("qq", '"', uninterp(escape_str unback $str), $self); } else { diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t index 155a154..ed05e6e 100644 --- a/lib/B/Deparse.t +++ b/lib/B/Deparse.t @@ -550,6 +550,7 @@ $_ .= <ARGV> . <$foo>; #### # \x{} my $foo = "Ab\x{100}\200\x{200}\237Cd\000Ef\x{1000}\cA\x{2000}\cZ"; +my $bar = "\x{100}"; #### # s///e s/x/'y';/e; -- Perl5 Master Repository
