[perl #76814] FETCH called twice - ||
authorFather Chrysostomos <sprout@cpan.org>
Sun, 27 Feb 2011 08:50:08 +0000 (00:50 -0800)
committerFather Chrysostomos <sprout@cpan.org>
Sun, 27 Feb 2011 08:50:08 +0000 (00:50 -0800)
commit1c3caf3f8c1b996b57e6fd1e4eadcfb9272a4741
treefaf2a87d5eb616b2b2bfc1c9e496bfe609002bb7
parent8818d4099a576554d990d17764107b1b1480bead
[perl #76814] FETCH called twice - ||

The || case in t/op/tie_fetch_count.t is not a bug, as there are two
separate operators operating on it in the test script. In

  $dummy = $x || $y

The || does mg_get($x). If it’s true it returns it and the = does
mg_get($x). If $x is false, then $y is returned, so magic is called
once on each of $x and $y. Similarly, && will seemingly call
mg_get($x) twice if $x is false.

If you just write:

  $x || $y

then magic is only called once on $x.

This patch corrects the test.
t/op/tie_fetch_count.t