summaryrefslogtreecommitdiff
path: root/pp_sys.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 /pp_sys.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 'pp_sys.c')
-rw-r--r--pp_sys.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/pp_sys.c b/pp_sys.c
index b1ce18a100..4b1a1e7b9f 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -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));