diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-01-13 23:38:57 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-01-13 23:38:57 -0800 |
commit | eb4c377af757baa899bb66137d53187fcea634db (patch) | |
tree | bbe73115472d6aeea38c6dcb5b5b1808905e7afe /t | |
parent | 93fad9301a05ccd2d02b9949ee59a69708b508e1 (diff) | |
download | perl-eb4c377af757baa899bb66137d53187fcea634db.tar.gz |
Make -T _ and -B _ always set PL_laststatval
-T _ and -B _ always do another stat() on the previous file handle or
filename, unless it is a handle that has been closed.
Normally, the internal stat buffer, status, etc., are reset even for
_. This happens even on a failed fstat().
-T HANDLE and -B HANDLE currently *do* reset the stat status
(PL_laststatval) if there is no IO thingy, so having -T _ and -B _ not
do that makes things needlessly inconsistent.
Diffstat (limited to 't')
-rw-r--r-- | t/op/filetest.t | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/t/op/filetest.t b/t/op/filetest.t index cf7a02dae4..65d914781a 100644 --- a/t/op/filetest.t +++ b/t/op/filetest.t @@ -10,7 +10,7 @@ BEGIN { } use Config; -plan(tests => 42 + 27*14); +plan(tests => 43 + 27*14); ok( -d 'op' ); ok( -f 'TEST' ); @@ -253,7 +253,7 @@ for my $op (split //, "rwxoRWXOezsfdlpSbctugkTMBAC") { my $Perl = which_perl(); SKIP: { - skip "no -T on filehandles", 5 unless eval { -T STDERR; 1 }; + skip "no -T on filehandles", 6 unless eval { -T STDERR; 1 }; # Test that -T HANDLE sets the last stat type -l "perl.c"; # last stat type is now lstat @@ -287,6 +287,12 @@ SKIP: { # and after -r $ioref -r *$fh{IO}; ok -T _, '-T _ works after -r $ioref'; + + # -T _ on closed filehandle should still reset stat info + stat $fh; + close $fh; + -T _; + ok !stat _, '-T _ on closed filehandle resets stat info'; } is runperl(prog => '-T _', switches => ['-w'], stderr => 1), "", |