Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

defined(@array) now also warns for package variables.

  • Loading branch information...
commit 604a99bd464c92d77ef2476ab9779cddb72339c4 1 parent b880f70
Nicholas Clark authored
View
5 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),
View
5 pod/perldelta.pod
@@ -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
View
2  t/lib/strict/refs
@@ -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
View
1  t/lib/warnings/op
@@ -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.
Please sign in to comment.
Something went wrong with that request. Please try again.