From 935647290357b277a54366c3caf2ddc89bfbd3eb Mon Sep 17 00:00:00 2001 From: Father Chrysostomos Date: Thu, 8 Sep 2011 18:03:02 -0700 Subject: 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. --- t/op/tie_fetch_count.t | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 't/op/tie_fetch_count.t') 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 # ############################################### -- cgit v1.2.1