summaryrefslogtreecommitdiff
path: root/t/op/tie_fetch_count.t
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-09-08 18:03:02 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-09-08 18:03:47 -0700
commit935647290357b277a54366c3caf2ddc89bfbd3eb (patch)
treef7a8e1824ccf51a775c703fc284e3d502ab18a02 /t/op/tie_fetch_count.t
parent8d4393cf0f53c9e46fd1338d29417f254bd6d1cd (diff)
downloadperl-935647290357b277a54366c3caf2ddc89bfbd3eb.tar.gz
ch(dir|mod|own) should not ignore get-magic on glob(ref)s
When the chdir(*handle) feature was added in 5.8.8, the fact that globs and refs could be magical was not taken into account. They can easily be magical if a typeglob or reference is returned from or assigned to a tied variable.
Diffstat (limited to 't/op/tie_fetch_count.t')
-rw-r--r--t/op/tie_fetch_count.t16
1 files changed, 11 insertions, 5 deletions
diff --git a/t/op/tie_fetch_count.t b/t/op/tie_fetch_count.t
index 41d73087bf..5903377180 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 => 220);
+ plan (tests => 223);
}
use strict;
@@ -43,10 +43,7 @@ tie my $var => 'main', 1;
# Assignment.
$dummy = $var ; check_count "=";
-{
- no warnings 'once';
- *dummy = $var ; check_count '*glob = $tied';
-}
+*dummy = $var ; check_count '*glob = $tied';
# Unary +/-
$dummy = +$var ; check_count "unary +";
@@ -220,6 +217,15 @@ $var8->bolgy ; check_count '->method';
*$var9 = \&{"glumscrin"}; check_count '*$tied = \&{"name of const"}';
}
+# This line makes $var8 hold a glob:
+$var8 = *dummy; $dummy = $var8; $count = 0;
+eval { chdir $var8 } ; check_count 'chdir $tied_glob';
+$var8 = *dummy; $dummy = $var8; $count = 0;
+eval { chmod 0, $var8 } ; check_count 'chmod 0,$tied_glob';
+$var8 = *dummy; $dummy = $var8; $count = 0;
+eval { chown 0,0,$var8 }; check_count 'chmod 0,$tied_glob';
+
+
###############################################
# Tests for $foo binop $foo #
###############################################