diff options
author | Father Chrysostomos <sprout@cpan.org> | 2013-06-04 18:32:46 -0700 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2013-06-04 20:16:04 -0700 |
commit | 5840701a1aaa2086a9631a3f4f153e3c9f9a0a9f (patch) | |
tree | b9840877822cd46f82f19715d343c00132b5e963 /doio.c | |
parent | 929c6ecf94db1e29600848f3d1acc64c825d9fc7 (diff) | |
download | perl-5840701a1aaa2086a9631a3f4f153e3c9f9a0a9f.tar.gz |
-l $handle warning: globs, iorefs, utf8
The warning restored in commit cd22fad3cbcea only applied to globrefs,
not to globs or iorefs. The warning message was also not utf8-clean.
This commit fixes both.
This resolves ticket #117595.
Diffstat (limited to 'doio.c')
-rw-r--r-- | doio.c | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -1337,6 +1337,7 @@ Perl_my_lstat_flags(pTHX_ const U32 flags) dSP; const char *file; SV* const sv = TOPs; + bool isio = FALSE; if (PL_op->op_flags & OPf_REF) { if (cGVOP_gv == PL_defgv) { if (PL_laststype != OP_LSTAT) @@ -1345,6 +1346,7 @@ Perl_my_lstat_flags(pTHX_ const U32 flags) } PL_laststatval = -1; if (ckWARN(WARN_IO)) { + /* diag_listed_as: Use of -l on filehandle%s */ Perl_warner(aTHX_ packWARN(WARN_IO), "Use of -l on filehandle %"HEKf, HEKfARG(GvENAME_HEK(cGVOP_gv))); @@ -1360,9 +1362,22 @@ Perl_my_lstat_flags(pTHX_ const U32 flags) PL_laststype = OP_LSTAT; PL_statgv = NULL; - 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))); + if ( ( (SvROK(sv) && ( isGV_with_GP(SvRV(sv)) + || (isio = SvTYPE(SvRV(sv)) == SVt_PVIO) ) + ) + || isGV_with_GP(sv) + ) + && ckWARN(WARN_IO)) { + if (isio) + /* diag_listed_as: Use of -l on filehandle%s */ + Perl_warner(aTHX_ packWARN(WARN_IO), + "Use of -l on filehandle"); + else + /* diag_listed_as: Use of -l on filehandle%s */ + Perl_warner(aTHX_ packWARN(WARN_IO), + "Use of -l on filehandle %"HEKf, + GvENAME_HEK((const GV *) + (SvROK(sv) ? SvRV(sv) : sv))); } file = SvPV_flags_const_nolen(sv, flags); sv_setpv(PL_statname,file); |