In addition to a stat buffer, Perl keeps track internally of which
type of stat was done last, either stat or lstat, so that lstat _ can
die if the previous type was stat.
This was not being reset for stat $ioref. Filetest ops were fine.
io = MUTABLE_IO(SvRV(sv));
if (PL_op->op_type == OP_LSTAT)
goto do_fstat_warning_check;
+ PL_laststype = OP_STAT;
goto do_fstat_have_io;
}
}
-plan tests => 109;
+plan tests => 110;
my $Perl = which_perl();
is( "$@", "", "lstat _ ok after lstat" );
eval { -l _ };
is( "$@", "", "-l _ ok after lstat" );
+
+lstat "test.pl";
+{
+ open my $fh, "test.pl";
+ stat *$fh{IO};
+ eval { lstat _ }
+}
+like $@, qr/^The stat preceding lstat\(\) wasn't an lstat at /,
+'stat $ioref resets stat type';
SKIP: {
skip "No lstat", 2 unless $Config{d_lstat};