From 5d3e98def4ec5753a5f78c106401b1351d752266 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Sat, 2 Feb 2002 23:24:54 +0100 Subject: lstat FH and -l FH warnings Message-ID: <20020202222454.A11608@rafael> p4raw-id: //depot/perl@14530 --- pp_sys.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'pp_sys.c') 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)); -- cgit v1.2.1