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 /doio.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 'doio.c')
-rw-r--r-- | doio.c | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -1308,13 +1308,22 @@ Perl_my_lstat(pTHX) Perl_croak(aTHX_ "The stat preceding -l _ wasn't an lstat"); return PL_laststatval; } - Perl_croak(aTHX_ "You can't use -l on a filehandle"); + if (ckWARN(WARN_IO)) { + Perl_warner(aTHX_ WARN_IO, "Use of -l on filehandle %s", + GvENAME(cGVOP_gv)); + return (PL_laststatval = -1); + } } PL_laststype = OP_LSTAT; PL_statgv = Nullgv; sv = POPs; PUTBACK; + if (SvROK(sv) && SvTYPE(SvRV(sv)) == SVt_PVGV && ckWARN(WARN_IO)) { + Perl_warner(aTHX_ WARN_IO, "Use of -l on filehandle %s", + GvENAME((GV*) SvRV(sv))); + return (PL_laststatval = -1); + } sv_setpv(PL_statname,SvPV(sv, n_a)); PL_laststatval = PerlLIO_lstat(SvPV(sv, n_a),&PL_statcache); if (PL_laststatval < 0 && ckWARN(WARN_NEWLINE) && strchr(SvPV(sv, n_a), '\n')) |