Change 29900 by [EMAIL PROTECTED] on 2007/01/20 23:40:23
defined @$foo and defined %$bar should be subject to strict 'refs';
Affected files ...
... //depot/perl/lib/DBM_Filter.pm#2 edit
... //depot/perl/pp_hot.c#500 edit
... //depot/perl/t/lib/strict/refs#4 edit
Differences ...
==== //depot/perl/lib/DBM_Filter.pm#2 (text) ====
Index: perl/lib/DBM_Filter.pm
--- perl/lib/DBM_Filter.pm#1~22168~ 2004-01-17 09:38:21.000000000 -0800
+++ perl/lib/DBM_Filter.pm 2007-01-20 15:40:23.000000000 -0800
@@ -2,7 +2,7 @@
use strict;
use warnings;
-our $VERSION = '0.01';
+our $VERSION = '0.02';
package Tie::Hash ;
@@ -91,6 +91,7 @@
# if $class already contains "::", don't prefix "DBM_Filter::"
$class = "DBM_Filter::$class" unless $class =~ /::/;
+ no strict 'refs';
# does the "DBM_Filter::$class" exist?
if ( ! defined %{ "${class}::"} ) {
# Nope, so try to load it.
@@ -98,7 +99,6 @@
croak "$caller: Cannot Load DBM Filter '$class': $@" if $@;
}
- no strict 'refs';
my $fetch = *{ "${class}::Fetch" }{CODE};
my $store = *{ "${class}::Store" }{CODE};
my $filter = *{ "${class}::Filter" }{CODE};
==== //depot/perl/pp_hot.c#500 (text) ====
Index: perl/pp_hot.c
--- perl/pp_hot.c#499~29836~ 2007-01-15 10:15:54.000000000 -0800
+++ perl/pp_hot.c 2007-01-20 15:40:23.000000000 -0800
@@ -836,9 +836,15 @@
if (SvROK(sv))
goto wasref;
}
+ if (PL_op->op_private & HINT_STRICT_REFS) {
+ if (SvOK(sv))
+ DIE(aTHX_ PL_no_symref_sv, sv,
+ is_pp_rv2av ? an_array : a_hash);
+ else
+ DIE(aTHX_ PL_no_usym, is_pp_rv2av ? an_array : a_hash);
+ }
if (!SvOK(sv)) {
- if (PL_op->op_flags & OPf_REF ||
- PL_op->op_private & HINT_STRICT_REFS)
+ if (PL_op->op_flags & OPf_REF)
DIE(aTHX_ PL_no_usym, is_pp_rv2av ? an_array : a_hash);
if (ckWARN(WARN_UNINITIALIZED))
report_uninit(sv);
@@ -860,9 +866,6 @@
}
}
else {
- if (PL_op->op_private & HINT_STRICT_REFS)
- DIE(aTHX_ PL_no_symref_sv, sv,
- is_pp_rv2av ? an_array : a_hash);
gv = (GV*)gv_fetchsv(sv, GV_ADD, type);
}
}
==== //depot/perl/t/lib/strict/refs#4 (text) ====
Index: perl/t/lib/strict/refs
--- perl/t/lib/strict/refs#3~26374~ 2005-12-15 10:00:34.000000000 -0800
+++ perl/t/lib/strict/refs 2007-01-20 15:40:23.000000000 -0800
@@ -308,3 +308,17 @@
defined $$x;
EXPECT
Can't use string ("foo") as a SCALAR ref while "strict refs" in use at - line
4.
+########
+# [perl #37886] strict 'refs' doesn't apply inside defined
+use strict 'refs';
+my $x = "foo";
+defined @$x;
+EXPECT
+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
+use strict 'refs';
+my $x = "foo";
+defined %$x;
+EXPECT
+Can't use string ("foo") as a HASH ref while "strict refs" in use at - line 4.
End of Patch.