From: Michael G Schwern Date: Tue, 12 Jul 2005 15:36:54 +0000 (-0700) Subject: [perl #6749] Perl debugger outputs ctrl-\ wrongly X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=bd6f3d36ec51e9bd1117df61e303904126a8537a;p=p5sagit%2Fp5-mst-13.2.git [perl #6749] Perl debugger outputs ctrl-\ wrongly From: "Michael G Schwern via RT" Message-ID: p4raw-id: //depot/perl@25130 --- diff --git a/lib/dumpvar.pl b/lib/dumpvar.pl index 474818a..43e107f 100644 --- a/lib/dumpvar.pl +++ b/lib/dumpvar.pl @@ -80,7 +80,7 @@ sub stringify { } elsif ($unctrl eq 'quote') { s/([\"\\\$\@])/\\$1/g if $tick eq '"'; s/\033/\\e/g; - s/([\000-\037\177])/'\\c'.chr(ord($1)^64)/eg; + s/([\000-\037\177])/'\\c'._escaped_ord($1)/eg; } $_ = uniescape($_); s/([\200-\377])/'\\'.sprintf('%3o',ord($1))/eg if $quoteHighBit; @@ -89,6 +89,14 @@ sub stringify { : $tick . $_ . $tick; } +# Ensure a resulting \ is escaped to be \\ +sub _escaped_ord { + my $chr = shift; + $chr = chr(ord($chr)^64); + $chr =~ s{\\}{\\\\}g; + return $chr; +} + sub ShortArray { my $tArrayDepth = $#{$_[0]} ; $tArrayDepth = $#{$_[0]} < $arrayDepth-1 ? $#{$_[0]} : $arrayDepth-1