summaryrefslogtreecommitdiff
path: root/t/op/local.t
diff options
context:
space:
mode:
authorStephen McCamant <alias@mcs.com>1997-06-15 21:23:45 +1200
committerTim Bunce <Tim.Bunce@ig.co.uk>1997-08-07 00:00:00 +1200
commit706a304b44357647b233945e4e432234718ab515 (patch)
tree3ba80bbbfc7a21f4e239b1548dc9c3ba91ef06f5 /t/op/local.t
parent21fc060b433a5fd003b9aca5789342207c46ada4 (diff)
downloadperl-706a304b44357647b233945e4e432234718ab515.tar.gz
Band-aid fix for local([@%]$x)
This fixes the segfaults by extending the prohibition on `local($$x)' to array and hash dereferences and removing the code that never worked. It also adds simple test cases and a `through' to the error message. The new explanation in perldiag isn't terribly clear, but the old one told an untruth. It should be possible to make local([$@%]$x) work by adding a new SAVEt type, and I'd like to do so in the future, but that certainly wouldn't be maintenance patch material. p5p-msgid: m0wsb7J-000EYPC@alias-2.pr.mcs.net
Diffstat (limited to 't/op/local.t')
-rwxr-xr-xt/op/local.t11
1 files changed, 10 insertions, 1 deletions
diff --git a/t/op/local.t b/t/op/local.t
index 043201072d..f527c9c9a9 100755
--- a/t/op/local.t
+++ b/t/op/local.t
@@ -2,7 +2,7 @@
# $RCSfile: local.t,v $$Revision: 4.1 $$Date: 92/08/07 18:28:04 $
-print "1..20\n";
+print "1..23\n";
sub foo {
local($a, $b) = @_;
@@ -43,3 +43,12 @@ $d{''} = "ok 18\n";
print &foo2("ok 11\n","ok 12\n");
print $a,@b,@c,%d,$x,$y;
+
+eval 'local($$e)';
+print +($@ =~ /Can't localize through a reference/) ? "" : "not ", "ok 21\n";
+
+eval 'local(@$e)';
+print +($@ =~ /Can't localize through a reference/) ? "" : "not ", "ok 22\n";
+
+eval 'local(%$e)';
+print +($@ =~ /Can't localize through a reference/) ? "" : "not ", "ok 23\n";