PL_statgv = NULL;
sv = POPs;
PUTBACK;
- if (SvROK(sv) && isGV_with_GP(SvRV(sv)) && ckWARN(WARN_IO)) {
- Perl_warner(aTHX_ packWARN(WARN_IO), "Use of -l on filehandle %s",
- GvENAME((const GV *)SvRV(sv)));
- return (PL_laststatval = -1);
- }
file = SvPV_flags_const_nolen(sv, flags);
sv_setpv(PL_statname,file);
PL_laststatval = PerlLIO_lstat(file,&PL_statcache);
filetest op has the special "_" handle for its argument and the most
recent C<stat>/C<lstat> call was an C<lstat>.
+=item *
+
+In Perl 5.6, C<-l> followed by anything other than a bareword would treat
+its argument as a file name. That was changed in 5.8 for glob references
+(C<\*foo>), but not for globs themselves (C<*foo>). Glob references
+started being treated as file handles, but only if warnings were turned on.
+In other words, it was simply buggy and inconsistent. Now the 5.6
+behaviour has been restored.
+
=back
=head1 Known Problems
# doio.c [Perl_my_stat]
use warnings 'io';
-l STDIN;
--l $fh;
-open $fh, $0 or die "# $!";
--l $fh;
no warnings 'io';
-l STDIN;
--l $fh;
-close $fh;
EXPECT
Use of -l on filehandle STDIN at - line 3.
-Use of -l on filehandle $fh at - line 6.
########
# doio.c [Perl_do_aexec5]
use warnings 'io' ;
}
use Config;
-plan(tests => 33 + 27*14);
+plan(tests => 34 + 27*14);
ok( -d 'op' );
ok( -f 'TEST' );
`ln -s TEST 1`;
ok ! -l -e _, 'stacked -l uses previous stat, not previous retval';
unlink 1;
+
+ # Since we already have our skip block set up, we might as well put this
+ # test here, too:
+ # -l always treats a non-bareword argument as a file name
+ system qw "ln -s TEST", \*foo;
+ local $^W = 1;
+ ok -l \*foo, '-l \*foo is a file name';
+ unlink \*foo;
}
# test that _ is a bareword after filetest operators