summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2002-02-02 23:24:54 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2002-02-03 15:30:24 +0000
commit5d3e98def4ec5753a5f78c106401b1351d752266 (patch)
tree1c6825ae8b85f9490774a26cb29d06bda548a789 /doio.c
parent1d662fb62e71ab3e37603febfa8212dd1e7e7f7e (diff)
downloadperl-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.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/doio.c b/doio.c
index 3c06585356..68853c2d38 100644
--- a/doio.c
+++ b/doio.c
@@ -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'))