summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pod/perldiag.pod5
-rw-r--r--pod/perlref.pod4
-rw-r--r--pp.c5
-rwxr-xr-xt/op/gv.t11
4 files changed, 22 insertions, 3 deletions
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index 4dd8d40869..c0fff95554 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -3848,6 +3848,11 @@ returns no useful value. See L<perlmod>.
(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 a62276b782..e8e9ab78fa 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<perlfunc/open>), sockets
(L<perlfunc/socket> and L<perlfunc/socketpair>), and directory
handles (L<perlfunc/opendir>). 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 5ab80aae7c..eca00c8ec2 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 431910b298..a423cb49ed 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