From: Jarkko Hietaniemi Date: Fri, 5 Sep 2003 04:13:17 +0000 (+0000) Subject: Another seemingly fixed (un)tie bug, X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dd12389b7c5ebc1a14261d71b7d5edca29c6e097;p=p5sagit%2Fp5-mst-13.2.git Another seemingly fixed (un)tie bug, [perl ##22297] cannot untie scalar from within tied FETCH p4raw-id: //depot/perl@21039 --- diff --git a/t/op/tie.t b/t/op/tie.t index 7e45615..f30f693 100755 --- a/t/op/tie.t +++ b/t/op/tie.t @@ -405,3 +405,44 @@ Two 4 Three 4 +######## +# [perl #22297] cannot untie scalar from within tied FETCH +my $counter = 0; +my $x = 7; +my $ref = \$x; +tie $x, 'Overlay', $ref, $x; +my $y; +$y = $x; +$y = $x; +$y = $x; +$y = $x; +#print "WILL EXTERNAL UNTIE $ref\n"; +untie $$ref; +$y = $x; +$y = $x; +$y = $x; +$y = $x; +#print "counter = $counter\n"; + +print (($counter == 1) ? "ok\n" : "not ok\n"); + +package Overlay; + +sub TIESCALAR +{ + my $pkg = shift; + my ($ref, $val) = @_; + return bless [ $ref, $val ], $pkg; +} + +sub FETCH +{ + my $self = shift; + my ($ref, $val) = @$self; + #print "WILL INTERNAL UNITE $ref\n"; + $counter++; + untie $$ref; + return $val; +} +EXPECT +ok