This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
defined(@array) now also warns for package variables.
authorNicholas Clark <nick@ccl4.org>
Wed, 4 Jan 2012 10:36:25 +0000 (11:36 +0100)
committerNicholas Clark <nick@ccl4.org>
Mon, 16 Jan 2012 15:26:28 +0000 (16:26 +0100)
op.c
pod/perldelta.pod
t/lib/strict/refs
t/lib/warnings/op

diff --git a/op.c b/op.c
index b448def..d4dcf53 100644 (file)
--- a/op.c
+++ b/op.c
@@ -8215,11 +8215,6 @@ Perl_ck_defined(pTHX_ OP *o)             /* 19990527 MJD */
     if ((o->op_flags & OPf_KIDS)) {
        switch (cUNOPo->op_first->op_type) {
        case OP_RV2AV:
-           /* This is needed for
-              if (defined %stash::)
-              to work.   Do not break Tk.
-              */
-           break;                      /* Globals via GV can be undef */
        case OP_PADAV:
        case OP_AASSIGN:                /* Is this a good idea? */
            Perl_ck_warner_d(aTHX_ packWARN(WARN_DEPRECATED),
index 854779e..458bc4c 100644 (file)
@@ -412,7 +412,10 @@ tying a special array like C<@_>.  You should never see this message.
 
 =item *
 
-XXX L<message|perldiag/"message">
+L<defined(@array) is deprecated|perldiag/"defined(@array) is deprecated">
+
+The long-deprecated C<defined(@array)> now also warns for package variables.
+Previously it only issued a warning for lexical variables.
 
 =back
 
index 09b962f..d9bff7c 100644 (file)
@@ -322,6 +322,8 @@ use strict 'refs';
 my $x = "foo";
 defined @$x;
 EXPECT
+defined(@array) is deprecated at - line 4.
+       (Maybe you should just omit the defined()?)
 Can't use string ("foo") as an ARRAY ref while "strict refs" in use at - line 4.
 ########
 # [perl #37886] strict 'refs' doesn't apply inside defined
index b449103..344cf12 100644 (file)
@@ -799,7 +799,6 @@ my $a
 EXPECT
 ########
 # op.c
-# TODO - defined @::array doesn't warn yet.
 defined(@a);
 EXPECT
 defined(@array) is deprecated at - line 2.