From: chromatic Date: Sat, 22 Sep 2001 21:27:56 +0000 (-0600) Subject: Re: X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=39b99f2105ed8866b81c468bff75857b0c5187f9;p=p5sagit%2Fp5-mst-13.2.git Re: Forgotten deprecation of *glob{FILEHANDLE}? Message-Id: <20010923033252.33085.qmail@onion.perl.org> p4raw-id: //depot/perl@12153 --- diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 4dd8d40..c0fff95 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -3848,6 +3848,11 @@ returns no useful value. See L. (D deprecated) You are now encouraged to use the explicitly quoted form if you wish to use an empty line as the terminator of the here-document. +=item Use of *glob{FILEHANDLE} is deprecated + +(D deprecated) You are now encouraged to use the shorter *glob{IO} form +to access the filehandle slot within a typeglob. + =item Use of implicit split to @_ is deprecated (D deprecated) It makes a lot of work for the compiler when you clobber diff --git a/pod/perlref.pod b/pod/perlref.pod index a62276b..e8e9ab7 100644 --- a/pod/perlref.pod +++ b/pod/perlref.pod @@ -243,7 +243,9 @@ All of these are self-explanatory except for C<*foo{IO}>. It returns the IO handle, used for file handles (L), sockets (L and L), and directory handles (L). For compatibility with previous -versions of Perl, C<*foo{FILEHANDLE}> is a synonym for C<*foo{IO}>. +versions of Perl, C<*foo{FILEHANDLE}> is a synonym for C<*foo{IO}>, though it +is deprecated as of 5.8.0. If deprecation warnings are in effect, it will warn +of its use. C<*foo{THING}> returns undef if that particular THING hasn't been used yet, except in the case of scalars. C<*foo{SCALAR}> returns a reference to an diff --git a/pp.c b/pp.c index 5ab80aa..eca00c8 100644 --- a/pp.c +++ b/pp.c @@ -550,8 +550,11 @@ PP(pp_gelem) tmpRef = (SV*)GvCVu(gv); break; case 'F': - if (strEQ(elem, "FILEHANDLE")) /* XXX deprecate in 5.005 */ + if (strEQ(elem, "FILEHANDLE")) { + /* finally deprecated in 5.8.0 */ + deprecate("*glob{FILEHANDLE}"); tmpRef = (SV*)GvIOp(gv); + } else if (strEQ(elem, "FORMAT")) tmpRef = (SV*)GvFORM(gv); diff --git a/t/op/gv.t b/t/op/gv.t index 431910b..a423cb4 100755 --- a/t/op/gv.t +++ b/t/op/gv.t @@ -104,7 +104,16 @@ print ref *x{FORMAT} eq "FORMAT" ? "ok 21\n" : "not ok 21\n"; *x = *STDOUT; print *{*x{GLOB}} eq "*main::STDOUT" ? "ok 22\n" : "not ok 22\n"; print {*x{IO}} "ok 23\n"; -print {*x{FILEHANDLE}} "ok 24\n"; + +{ + my $warn; + local $SIG{__WARN__} = sub { + $warn .= $_[0]; + }; + my $val = *x{FILEHANDLE}; + print {*x{IO}} ($warn =~ /is deprecated/ ? "ok 24\n" : "not ok 24\n"); + +} # test if defined() doesn't create any new symbols