}
return (PL_laststatval = -1);
}
- else if (PL_laststype != OP_LSTAT
- && (PL_op->op_private & OPpFT_STACKED) && ckWARN(WARN_IO))
+ else if (PL_op->op_private & OPpFT_STACKED) {
+ if (PL_laststype != OP_LSTAT)
Perl_croak(aTHX_ no_prev_lstat);
+ return PL_laststatval;
+ }
PL_laststype = OP_LSTAT;
PL_statgv = NULL;
running with the lexical hints of the subroutine it replaced, instead of
that subroutine's caller. This has been fixed.
+=item *
+
+Stacked C<-l> (followed immediately by other filetest operators) did not
+work previously; now it does. It is only permitted when the rightmost
+filetest op has the special "_" handle for its argument and the most
+recent C<stat>/C<lstat> call was an C<lstat>.
+
=back
=head1 Known Problems
}
use Config;
-plan(tests => 30 + 27*14);
+plan(tests => 33 + 27*14);
ok( -d 'op' );
ok( -f 'TEST' );
is( -s -f $tempfile, 0 );
unlink_all $tempfile;
+# stacked -l
+eval { -l -e "TEST" };
+like $@, qr/^The stat preceding -l _ wasn't an lstat at /,
+ 'stacked -l non-lstat error with warnings off';
+{
+ local $^W = 1;
+ eval { -l -e "TEST" };
+ like $@, qr/^The stat preceding -l _ wasn't an lstat at /,
+ 'stacked -l non-lstat error with warnings on';
+}
+# Make sure -l is using the previous stat buffer, and not using the previ-
+# ous op’s return value as a file name.
+SKIP: {
+ use Perl::OSType 'os_type';
+ if (os_type ne 'Unix') { skip "Not Unix", 1 }
+ chomp(my $ln = `which ln`);
+ if ( ! -e $ln ) { skip "No ln" , 1 }
+ lstat "TEST";
+ `ln -s TEST 1`;
+ ok ! -l -e _, 'stacked -l uses previous stat, not previous retval';
+ unlink 1;
+}
+
# test that _ is a bareword after filetest operators
-f 'TEST';