summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMichael G Schwern <schwern@pobox.com>2005-07-12 08:36:54 -0700
committerH.Merijn Brand <h.m.brand@xs4all.nl>2005-07-13 06:27:48 +0000
commitbd6f3d36ec51e9bd1117df61e303904126a8537a (patch)
tree32c2d80075d895e6667b4c6b2bb64f2c72ccb081 /lib
parent041457d90dbb6fb79a72c7a8462f01423f2daa09 (diff)
downloadperl-bd6f3d36ec51e9bd1117df61e303904126a8537a.tar.gz
[perl #6749] Perl debugger outputs ctrl-\ wrongly
From: "Michael G Schwern via RT" <perlbug-followup@perl.org> Message-ID: <rt-3.0.11-6749-117055.16.4354496694007@perl.org> p4raw-id: //depot/perl@25130
Diffstat (limited to 'lib')
-rw-r--r--lib/dumpvar.pl10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/dumpvar.pl b/lib/dumpvar.pl
index 474818a657..43e107ff5f 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