summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorDoug MacEachern <dougm@covalent.net>2002-06-03 01:27:56 -0700
committerJarkko Hietaniemi <jhi@iki.fi>2002-06-05 20:48:18 +0000
commiteb85dfd35868e4b09d07b81ae578cef99fbf8150 (patch)
tree9c452f8d8ef6c9849abd5afd3fee39ba6a9d6390 /t
parent12b2c10f3f6560f07280f9e95bf5147601ef6195 (diff)
downloadperl-eb85dfd35868e4b09d07b81ae578cef99fbf8150.tar.gz
Re: local tied hash slices & stray keys (was Re: Cwd breakage)
Message-ID: <Pine.LNX.4.33.0206030822330.2695-100000@mako.covalent.net> (plus a test expanded from Schwern's [ID 20020602.006]) p4raw-id: //depot/perl@17022
Diffstat (limited to 't')
-rwxr-xr-xt/op/tie.t27
1 files changed, 27 insertions, 0 deletions
diff --git a/t/op/tie.t b/t/op/tie.t
index 5a72a1b8ea..d3bd45274d 100755
--- a/t/op/tie.t
+++ b/t/op/tie.t
@@ -240,3 +240,30 @@ tie FH, 'main';
EXPECT
Can't modify constant item in tie at - line 3, near "'main';"
Execution of - aborted due to compilation errors.
+########
+
+# localizing tied hash slices
+$ENV{FooA} = 1;
+$ENV{FooB} = 2;
+print exists $ENV{FooA} ? 1 : 0, "\n";
+print exists $ENV{FooB} ? 2 : 0, "\n";
+print exists $ENV{FooC} ? 3 : 0, "\n";
+{
+ local @ENV{qw(FooA FooC)};
+ print exists $ENV{FooA} ? 4 : 0, "\n";
+ print exists $ENV{FooB} ? 5 : 0, "\n";
+ print exists $ENV{FooC} ? 6 : 0, "\n";
+}
+print exists $ENV{FooA} ? 7 : 0, "\n";
+print exists $ENV{FooB} ? 8 : 0, "\n";
+print exists $ENV{FooC} ? 9 : 0, "\n"; # this should not exist
+EXPECT
+1
+2
+0
+4
+5
+6
+7
+8
+0