summaryrefslogtreecommitdiff
path: root/t/op/tie_fetch_count.t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-07-21 23:18:44 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-07-21 23:44:17 -0700
commit7ffa7e7540d4523072b049e2d1285c34faabeeb9 (patch)
treed071fe530bd6712b5576ac342d3087e4a9fac0ac /t/op/tie_fetch_count.t
parentabcb810c88ac3af57afe0fd06c1c339f104b10f9 (diff)
downloadperl-7ffa7e7540d4523072b049e2d1285c34faabeeb9.tar.gz
Don’t call get-magic twice for sym refs
Dereferencing ops (${}, etc.) were calling get-magic on their operand twice if it was a symbolic reference, except for &{}. This commit fixes that, adding tests for all the deref ops, including &{}, for good measure.
Diffstat (limited to 't/op/tie_fetch_count.t')
-rw-r--r--t/op/tie_fetch_count.t12
1 files changed, 11 insertions, 1 deletions
diff --git a/t/op/tie_fetch_count.t b/t/op/tie_fetch_count.t
index 6d2da1cd24..b9fd2751af 100644
--- a/t/op/tie_fetch_count.t
+++ b/t/op/tie_fetch_count.t
@@ -7,7 +7,7 @@ BEGIN {
chdir 't' if -d 't';
@INC = '../lib';
require './test.pl';
- plan (tests => 210);
+ plan (tests => 215);
}
use strict;
@@ -175,6 +175,16 @@ $dummy = keys $var3 ; check_count 'keys hashref';
tie my $var5 => 'main', sub {1};
$dummy = &$var5 ; check_count '&{}';
+{
+ no strict 'refs';
+ tie my $var1 => 'main', 1;
+ $dummy = $$var1 ; check_count 'symbolic ${}';
+ $dummy = @$var1 ; check_count 'symbolic @{}';
+ $dummy = %$var1 ; check_count 'symbolic %{}';
+ $dummy = *$var1 ; check_count 'symbolic *{}';
+ local *1 = sub{};
+ $dummy = &$var1 ; check_count 'symbolic &{}';
+}
###############################################
# Tests for $foo binop $foo #