summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pp_sys.c2
-rwxr-xr-xt/op/tie.t17
2 files changed, 18 insertions, 1 deletions
diff --git a/pp_sys.c b/pp_sys.c
index c556597bc7..77a547edbd 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -875,8 +875,8 @@ PP(pp_untie)
(UV)SvREFCNT(obj) - 1 ) ;
}
}
- sv_unmagic(sv, how) ;
}
+ sv_unmagic(sv, how) ;
RETPUSHYES;
}
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