diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2002-02-02 23:24:54 +0100 |
---|---|---|
committer | Jarkko Hietaniemi <jhi@iki.fi> | 2002-02-03 15:30:24 +0000 |
commit | 5d3e98def4ec5753a5f78c106401b1351d752266 (patch) | |
tree | 1c6825ae8b85f9490774a26cb29d06bda548a789 /pp_sys.c | |
parent | 1d662fb62e71ab3e37603febfa8212dd1e7e7f7e (diff) | |
download | perl-5d3e98def4ec5753a5f78c106401b1351d752266.tar.gz |
lstat FH and -l FH warnings
Message-ID: <20020202222454.A11608@rafael>
p4raw-id: //depot/perl@14530
Diffstat (limited to 'pp_sys.c')
-rw-r--r-- | pp_sys.c | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -2726,9 +2726,11 @@ PP(pp_stat) if (PL_op->op_flags & OPf_REF) { gv = cGVOP_gv; if (PL_op->op_type == OP_LSTAT) { - if (gv != PL_defgv) - Perl_croak(aTHX_ "You can't use lstat() on a filehandle"); - if (PL_laststype != OP_LSTAT) + if (gv != PL_defgv) { + if (ckWARN(WARN_IO)) + Perl_warner(aTHX_ WARN_IO, + "lstat() on filehandle %s", GvENAME(gv)); + } else if (PL_laststype != OP_LSTAT) Perl_croak(aTHX_ "The stat preceding lstat() wasn't an lstat"); } @@ -2754,6 +2756,9 @@ PP(pp_stat) } else if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVGV) { gv = (GV*)SvRV(sv); + if (PL_op->op_type == OP_LSTAT && ckWARN(WARN_IO)) + Perl_warner(aTHX_ WARN_IO, + "lstat() on filehandle %s", GvENAME(gv)); goto do_fstat; } sv_setpv(PL_statname, SvPV(sv,n_a)); |