diff options
author | Father Chrysostomos <sprout@cpan.org> | 2011-09-12 20:41:07 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2011-09-12 21:25:56 -0700 |
commit | 109c43ede9271ac02d808d98b7ef66bf7e66e033 (patch) | |
tree | ba14cb27b8d576e691667a2859f69064c77cdfbd /t/op | |
parent | 53b10071adc2e67f88bbc0d32e2dc6f982598c98 (diff) | |
download | perl-109c43ede9271ac02d808d98b7ef66bf7e66e033.tar.gz |
Make (l)stat respect get-magic on globs and globrefs
They were ignoring get-magic for those.
A side effect of this fix is that lstat filehandle warnings and errors
are now consistent:
lstat _ used to die if the previous stat was not an lstat, but
lstat *_ and lstat \*_ would happily return what was in the buffer.
Now they die.
lstat FH and \*FH used to warn, but not lstat *FH. Now it does.
See bug #98864.
Diffstat (limited to 't/op')
-rw-r--r-- | t/op/stat.t | 8 | ||||
-rw-r--r-- | t/op/tie_fetch_count.t | 4 |
2 files changed, 9 insertions, 3 deletions
diff --git a/t/op/stat.t b/t/op/stat.t index 1808ee4ae4..fccadbaaef 100644 --- a/t/op/stat.t +++ b/t/op/stat.t @@ -20,7 +20,7 @@ if(eval {require File::Spec; 1}) { } -plan tests => 107; +plan tests => 109; my $Perl = which_perl(); @@ -441,6 +441,12 @@ stat $0; eval { lstat _ }; like( $@, qr/^The stat preceding lstat\(\) wasn't an lstat/, 'lstat _ croaks after stat' ); +eval { lstat *_ }; +like( $@, qr/^The stat preceding lstat\(\) wasn't an lstat/, + 'lstat *_ croaks after stat' ); +eval { lstat \*_ }; +like( $@, qr/^The stat preceding lstat\(\) wasn't an lstat/, + 'lstat \*_ croaks after stat' ); eval { -l _ }; like( $@, qr/^The stat preceding -l _ wasn't an lstat/, '-l _ croaks after stat' ); diff --git a/t/op/tie_fetch_count.t b/t/op/tie_fetch_count.t index 6815d62acf..159712021a 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 => 282); + plan (tests => 286); } use strict; @@ -211,7 +211,7 @@ $var8->bolgy ; check_count '->method'; # Functions that operate on filenames or filehandles for ([chdir=>''],[chmod=>'0,'],[chown=>'0,0,'],[utime=>'0,0,'], - [truncate=>'',',0']) { + [truncate=>'',',0'],[stat=>''],[lstat=>'']) { my($op,$args,$postargs) = @$_; $postargs //= ''; # This line makes $var8 hold a glob: $var8 = *dummy; $dummy = $var8; $count = 0; |