summaryrefslogtreecommitdiff
path: root/t/io
diff options
context:
space:
mode:
authorChip Salzenberg <chip@pobox.com>2012-07-10 23:19:02 -0700
committerChip Salzenberg <chip@pobox.com>2012-07-10 23:19:02 -0700
commitb399897db8a3df44f65c21cfccdfa24fda1d4657 (patch)
tree3c956715cb6af7919a35a18fc89c0c166654b7b8 /t/io
parent6008229130183ac5d99c7ba4f4e05dfdb2734103 (diff)
downloadperl-b399897db8a3df44f65c21cfccdfa24fda1d4657.tar.gz
ensure shmread() calls get and set magic once
Diffstat (limited to 't/io')
-rw-r--r--t/io/shm.t12
1 files changed, 11 insertions, 1 deletions
diff --git a/t/io/shm.t b/t/io/shm.t
index 0ba566b1d4..4a8941ec75 100644
--- a/t/io/shm.t
+++ b/t/io/shm.t
@@ -55,7 +55,7 @@ if (not defined $key) {
}
}
else {
- plan(tests => 13);
+ plan(tests => 15);
pass('acquired shared mem');
}
@@ -80,3 +80,13 @@ shmwrite $key, $int, 0, 1;
shmread $key, $number, 0, 1;
is("$number", $int, qq{"\$id" eq "$int"});
cmp_ok($number + 0, '==', $int, "\$id + 0 == $int");
+
+my ($fetch, $store) = (0, 0);
+{ package Counted;
+ sub TIESCALAR { bless [undef] }
+ sub FETCH { ++$fetch; $_[0][0] }
+ sub STORE { ++$store; $_[0][0] = $_[1] } }
+tie $ct, 'Counted';
+shmread $key, $ct, 0, 1;
+is($fetch, 1, "shmread FETCH once");
+is($store, 1, "shmread STORE once");