summaryrefslogtreecommitdiff
path: root/t/op/tie.t
diff options
context:
space:
mode:
Diffstat (limited to 't/op/tie.t')
-rwxr-xr-xt/op/tie.t17
1 files changed, 17 insertions, 0 deletions
diff --git a/t/op/tie.t b/t/op/tie.t
index d643b78282..dfbf44b559 100755
--- a/t/op/tie.t
+++ b/t/op/tie.t
@@ -326,3 +326,20 @@ print $f4{'foo'}[0],"\n";
EXPECT
2
3
+########
+# test untie() from within FETCH
+package Foo;
+sub TIESCALAR { my $pkg = shift; return bless [@_], $pkg; }
+sub FETCH {
+ my $self = shift;
+ my ($obj, $field) = @$self;
+ untie $obj->{$field};
+ $obj->{$field} = "Bar";
+}
+package main;
+tie $a->{foo}, "Foo", $a, "foo";
+$a->{foo}; # access once
+# the hash element should not be tied anymore
+print defined tied $a->{foo} ? "not ok" : "ok";
+EXPECT
+ok