summaryrefslogtreecommitdiff
path: root/pp_sys.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-03-30 07:48:59 +0000
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2007-03-30 07:48:59 +0000
commitabc718f2ca5cfe66c838e1324c1c153a085fea8b (patch)
tree23211c9fc93b1552429344d0efc4a0a611dd54ac /pp_sys.c
parent37723ebb3f0f145b85438cb89891a2c80a5f149e (diff)
downloadperl-abc718f2ca5cfe66c838e1324c1c153a085fea8b.tar.gz
Add two deprecation warnings:
Opening dirhandle %s also as a file Opening filehandle %s also as a directory p4raw-id: //depot/perl@30780
Diffstat (limited to 'pp_sys.c')
-rw-r--r--pp_sys.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 5693d5063c..aa36bef9aa 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -538,10 +538,15 @@ PP(pp_open)
if (!isGV(gv))
DIE(aTHX_ PL_no_usym, "filehandle");
+
if ((io = GvIOp(gv))) {
MAGIC *mg;
IoFLAGS(GvIOp(gv)) &= ~IOf_UNTAINT;
+ if (IoDIRP(io) && ckWARN2(WARN_IO, WARN_DEPRECATED))
+ Perl_warner(aTHX_ packWARN2(WARN_IO, WARN_DEPRECATED),
+ "Opening dirhandle %s also as a file", GvENAME(gv));
+
mg = SvTIED_mg((SV*)io, PERL_MAGIC_tiedscalar);
if (mg) {
/* Method's args are same as ours ... */
@@ -3769,6 +3774,9 @@ PP(pp_open_dir)
if (!io)
goto nope;
+ if ((IoIFP(io) || IoOFP(io)) && ckWARN2(WARN_IO, WARN_DEPRECATED))
+ Perl_warner(aTHX_ packWARN2(WARN_IO, WARN_DEPRECATED),
+ "Opening filehandle %s also as a directory", GvENAME(gv));
if (IoDIRP(io))
PerlDir_close(IoDIRP(io));
if (!(IoDIRP(io) = PerlDir_open(dirname)))