I know we should really be fixing local($_), but that code
in scope.c is rather twisted, and I want to see this fix
in 5.16.
# This one is good for variable names:
sub unctrl {
- local($_) = @_;
+ for (my($dummy) = shift) {
local($v) ;
return \$_ if ref \$_ eq "GLOB";
} else {
s/([\001-\037\177])/'^'.pack('c',ord($1)^64)/eg;
}
- $_;
+ return $_;
+ }
}
sub uniescape {
}
sub stringify {
- local($_,$noticks) = @_;
+ (my $__, local $noticks) = @_;
+ for ($__) {
local($v) ;
my $tick = $tick;
}
$_ = uniescape($_);
s/([\200-\377])/'\\'.sprintf('%3o',ord($1))/eg if $quoteHighBit;
- ($noticks || /^\d+(\.\d*)?\Z/)
+ return ($noticks || /^\d+(\.\d*)?\Z/)
? $_
: $tick . $_ . $tick;
+ }
}
# Ensure a resulting \ is escaped to be \\
use overload '""' => sub { "Bar<@{$_[0]}>" };
+package Tyre;
+
+sub TIESCALAR{bless[]}
+# other methods intentionally omitted
+
package main;
my $foo = Foo->new(1..5);
dumpvalue(bless[1,2,3,4],"a=b=c");
EXPECT
/0 a=b=c=ARRAY\(0x[0-9a-f]+\)\n 0 1\n 1 2\n 2 3\n 3 4\n/i
+########
+local *_; tie $_, 'Tyre'; stringify('');
+EXPECT
+''
+########
+local *_; tie $_, 'Tyre'; unctrl('abc');
+EXPECT
+abc