io = GvIO(PL_statgv);
}
PL_laststatval = -1;
+ PL_laststype = OP_STAT;
if (io && IoIFP(io)) {
if (! PerlIO_has_base(IoIFP(io)))
DIE(aTHX_ "-T and -B not implemented on filehandles");
PL_laststatval = PerlLIO_fstat(PerlIO_fileno(IoIFP(io)), &PL_statcache);
- PL_laststype = OP_STAT;
if (PL_laststatval < 0)
RETPUSHUNDEF;
if (S_ISDIR(PL_statcache.st_mode)) { /* handle NFS glitch */
}
use Config;
-plan(tests => 43 + 27*14);
+plan(tests => 44 + 27*14);
ok( -d 'op' );
ok( -f 'TEST' );
my $Perl = which_perl();
SKIP: {
- skip "no -T on filehandles", 6 unless eval { -T STDERR; 1 };
+ skip "no -T on filehandles", 7 unless eval { -T STDERR; 1 };
# Test that -T HANDLE sets the last stat type
-l "perl.c"; # last stat type is now lstat
close $fh;
-T _;
ok !stat _, '-T _ on closed filehandle resets stat info';
+
+ lstat "test.pl";
+ -T $fh; # closed
+ eval { lstat _ };
+ like $@, qr/^The stat preceding lstat\(\) wasn't an lstat at /,
+ '-T on closed handle resets last stat type';
}
is runperl(prog => '-T _', switches => ['-w'], stderr => 1), "",