diff options
Diffstat (limited to 'doio.c')
-rw-r--r-- | doio.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -1336,6 +1336,7 @@ Perl_my_lstat_flags(pTHX_ const U32 flags) static const char* const no_prev_lstat = "The stat preceding -l _ wasn't an lstat"; dSP; const char *file; + SV* const sv = TOPs; if (PL_op->op_flags & OPf_REF) { if (cGVOP_gv == PL_defgv) { if (PL_laststype != OP_LSTAT) @@ -1355,11 +1356,15 @@ Perl_my_lstat_flags(pTHX_ const U32 flags) if (PL_laststype != OP_LSTAT) Perl_croak(aTHX_ no_prev_lstat); return PL_laststatval; - } + } PL_laststype = OP_LSTAT; PL_statgv = NULL; - file = SvPV_flags_const_nolen(TOPs, flags); + 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))); + } + file = SvPV_flags_const_nolen(sv, flags); sv_setpv(PL_statname,file); PL_laststatval = PerlLIO_lstat(file,&PL_statcache); if (PL_laststatval < 0 && ckWARN(WARN_NEWLINE) && strchr(file, '\n')) |