diff options
author | Aaron J. Mackey <ajm6q@virginia.edu> | 2003-06-13 04:22:05 -0400 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2003-06-15 19:47:21 +0000 |
commit | 38193a09e3d9a4039dcc38f793ceb9482e7346d0 (patch) | |
tree | e89b515726bf2a53e30e760476110dbe2d626989 /t | |
parent | c23d2014b1a223f2595b3a2dcd8277fab2a0bb38 (diff) | |
download | perl-38193a09e3d9a4039dcc38f793ceb9482e7346d0.tar.gz |
Remove all magic in untie()
Subject: Re: untie from within FETCH/STORE not working under 5.8.0 (fwd)
Message-ID: <Pine.OSF.4.33.0306130820570.29017-100000@alpha10.bioch.virginia.edu>
(plus a test case)
p4raw-id: //depot/perl@19793
Diffstat (limited to 't')
-rwxr-xr-x | t/op/tie.t | 17 |
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 |