summaryrefslogtreecommitdiff
path: root/t/op/tie.t
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2003-09-05 04:13:17 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2003-09-05 04:13:17 +0000
commitdd12389b7c5ebc1a14261d71b7d5edca29c6e097 (patch)
tree7c4227619ddadaebb41255c76cbd8ba2ca21ab5e /t/op/tie.t
parentfec5e1eb396a5ed15ea5ee0c269e61721c3e028b (diff)
downloadperl-dd12389b7c5ebc1a14261d71b7d5edca29c6e097.tar.gz
Another seemingly fixed (un)tie bug,
[perl ##22297] cannot untie scalar from within tied FETCH p4raw-id: //depot/perl@21039
Diffstat (limited to 't/op/tie.t')
-rwxr-xr-xt/op/tie.t41
1 files changed, 41 insertions, 0 deletions
diff --git a/t/op/tie.t b/t/op/tie.t
index 7e45615aff..f30f69336d 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