In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/36b2db7e45905e9dd8cfbd2109f0057bca16508f?hp=4e7fd22c88572020fe1efa67cd1781126f901d9e>

- Log -----------------------------------------------------------------
commit 36b2db7e45905e9dd8cfbd2109f0057bca16508f
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Thu Nov 17 09:59:09 2011 -0800

    Re-deprecate $[
    
    This was something e1dccc0d3 removed that b82b06b8 failed to restore.

M       ext/arybase/arybase.xs
M       ext/arybase/t/aeach.t
M       ext/arybase/t/aelem.t
M       ext/arybase/t/akeys.t
M       ext/arybase/t/arybase.t
M       ext/arybase/t/aslice.t
M       ext/arybase/t/av2arylen.t
M       ext/arybase/t/index.t
M       ext/arybase/t/lslice.t
M       ext/arybase/t/pos.t
M       ext/arybase/t/scope.t
M       ext/arybase/t/splice.t
M       ext/arybase/t/substr.t
M       pod/perldiag.pod
M       t/lib/warnings/op
M       t/op/array_base.t

commit 184a899d763a26b6a80931a6502c5f95118eb106
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Thu Nov 17 09:38:20 2011 -0800

    arybase.xs: Don’t use arybase::[
    
    arybase was changing $[=1 to $arybase::[ = 1 to avoid any run-time
    effects.  In case this module is ever dual-lifed, we ought to avoid
    punctuation variables even outside the main stash.  See bug #76138.
    
    This is a classic example of paranoia.

M       ext/arybase/arybase.xs

commit 45aff279082494e5b76a5348427b63c8be1066aa
Author: Father Chrysostomos <spr...@cpan.org>
Date:   Thu Nov 17 09:35:53 2011 -0800

    arybase.xs: Check that $[ is in the main stash
    
    Check that $[ is in the main stash before doing anything magical with
    $[=1.  This can only be in another stash if some other XS module has
    overridden the check functions to change $[ to $foo::[.  But robust-
    ness is good, right?

M       ext/arybase/arybase.xs
-----------------------------------------------------------------------

Summary of changes:
 ext/arybase/arybase.xs    |    6 +++++-
 ext/arybase/t/aeach.t     |    2 +-
 ext/arybase/t/aelem.t     |    2 +-
 ext/arybase/t/akeys.t     |    2 +-
 ext/arybase/t/arybase.t   |    1 +
 ext/arybase/t/aslice.t    |    2 +-
 ext/arybase/t/av2arylen.t |    2 +-
 ext/arybase/t/index.t     |    2 +-
 ext/arybase/t/lslice.t    |    2 +-
 ext/arybase/t/pos.t       |    2 +-
 ext/arybase/t/scope.t     |    2 +-
 ext/arybase/t/splice.t    |    2 +-
 ext/arybase/t/substr.t    |    2 +-
 pod/perldiag.pod          |    5 +++++
 t/lib/warnings/op         |   15 +++++++++++++++
 t/op/array_base.t         |    1 +
 16 files changed, 38 insertions(+), 12 deletions(-)

diff --git a/ext/arybase/arybase.xs b/ext/arybase/arybase.xs
index 5c653e3..d654b54 100644
--- a/ext/arybase/arybase.xs
+++ b/ext/arybase/arybase.xs
@@ -137,6 +137,7 @@ STATIC bool ab_op_is_dollar_bracket(pTHX_ OP *o) {
  return o->op_type == OP_RV2SV && (o->op_flags & OPf_KIDS)
   && (c = cUNOPx(o)->op_first)
   && c->op_type == OP_GV
+  && GvSTASH(cGVOPx_gv(c)) == PL_defstash
   && strEQ(GvNAME(cGVOPx_gv(c)), "[");
 }
 
@@ -150,7 +151,7 @@ STATIC void ab_neuter_dollar_bracket(pTHX_ OP *o) {
   */
  oldc = cUNOPx(o)->op_first;
  newc = newGVOP(OP_GV, 0,
-   gv_fetchpvs("arybase::[", GV_ADDMULTI, SVt_PVGV));
+   gv_fetchpvs("arybase::leftbrack", GV_ADDMULTI, SVt_PVGV));
  cUNOPx(o)->op_first = newc;
  op_free(oldc);
 }
@@ -161,6 +162,9 @@ STATIC void ab_process_assignment(pTHX_ OP *left, OP 
*right) {
  if (ab_op_is_dollar_bracket(left) && right->op_type == OP_CONST) {
   set_arybase_to(SvIV(cSVOPx_sv(right)));
   ab_neuter_dollar_bracket(left);
+  Perl_ck_warner_d(aTHX_
+   packWARN(WARN_DEPRECATED), "Use of assignment to $[ is deprecated"
+  );
  }
 }
 
diff --git a/ext/arybase/t/aeach.t b/ext/arybase/t/aeach.t
index f56d39e..241677a 100644
--- a/ext/arybase/t/aeach.t
+++ b/ext/arybase/t/aeach.t
@@ -1,4 +1,4 @@
-use warnings;
+use warnings; no warnings 'deprecated';
 use strict;
 
 BEGIN {
diff --git a/ext/arybase/t/aelem.t b/ext/arybase/t/aelem.t
index d6b8c38..c26a2a8 100644
--- a/ext/arybase/t/aelem.t
+++ b/ext/arybase/t/aelem.t
@@ -1,4 +1,4 @@
-use warnings;
+use warnings; no warnings 'deprecated';
 use strict;
 
 use Test::More tests => 33;
diff --git a/ext/arybase/t/akeys.t b/ext/arybase/t/akeys.t
index 45af13b..53e9db1 100644
--- a/ext/arybase/t/akeys.t
+++ b/ext/arybase/t/akeys.t
@@ -1,4 +1,4 @@
-use warnings;
+use warnings; no warnings 'deprecated';
 use strict;
 
 BEGIN {
diff --git a/ext/arybase/t/arybase.t b/ext/arybase/t/arybase.t
index a7edaf4..f3d3287 100644
--- a/ext/arybase/t/arybase.t
+++ b/ext/arybase/t/arybase.t
@@ -3,6 +3,7 @@
 # Basic tests for $[ as a variable
 # plus miscellaneous bug fix tests
 
+no warnings 'deprecated';
 use Test::More tests => 7;
 
 sub outside_base_scope { return "${'['}" }
diff --git a/ext/arybase/t/aslice.t b/ext/arybase/t/aslice.t
index 38aa87b..f4a507d 100644
--- a/ext/arybase/t/aslice.t
+++ b/ext/arybase/t/aslice.t
@@ -1,4 +1,4 @@
-use warnings;
+use warnings; no warnings 'deprecated';
 use strict;
 
 use Test::More tests => 18;
diff --git a/ext/arybase/t/av2arylen.t b/ext/arybase/t/av2arylen.t
index 988cca9..6c1deb2 100644
--- a/ext/arybase/t/av2arylen.t
+++ b/ext/arybase/t/av2arylen.t
@@ -1,4 +1,4 @@
-use warnings;
+use warnings; no warnings 'deprecated';
 use strict;
 
 use Test::More tests => 8;
diff --git a/ext/arybase/t/index.t b/ext/arybase/t/index.t
index 58efe74..86dde88 100644
--- a/ext/arybase/t/index.t
+++ b/ext/arybase/t/index.t
@@ -1,4 +1,4 @@
-use warnings;
+use warnings; no warnings 'deprecated';
 use strict;
 
 use Test::More tests => 12;
diff --git a/ext/arybase/t/lslice.t b/ext/arybase/t/lslice.t
index 6247a5e..c012b84 100644
--- a/ext/arybase/t/lslice.t
+++ b/ext/arybase/t/lslice.t
@@ -1,4 +1,4 @@
-use warnings;
+use warnings; no warnings 'deprecated';
 use strict;
 
 use Test::More tests => 11;
diff --git a/ext/arybase/t/pos.t b/ext/arybase/t/pos.t
index f2f6504..970e17e 100644
--- a/ext/arybase/t/pos.t
+++ b/ext/arybase/t/pos.t
@@ -1,4 +1,4 @@
-use warnings;
+use warnings; no warnings 'deprecated';
 use strict;
 
 use Test::More tests => 12;
diff --git a/ext/arybase/t/scope.t b/ext/arybase/t/scope.t
index 5fb0993..07b4176 100644
--- a/ext/arybase/t/scope.t
+++ b/ext/arybase/t/scope.t
@@ -1,4 +1,4 @@
-use warnings;
+use warnings; no warnings 'deprecated';
 use strict;
 
 use Test::More tests => 14;
diff --git a/ext/arybase/t/splice.t b/ext/arybase/t/splice.t
index e2db280..9fd618a 100644
--- a/ext/arybase/t/splice.t
+++ b/ext/arybase/t/splice.t
@@ -1,4 +1,4 @@
-use warnings;
+use warnings; no warnings 'deprecated';
 use strict;
 
 use Test::More tests => 23;
diff --git a/ext/arybase/t/substr.t b/ext/arybase/t/substr.t
index 793293b..ecfba48 100644
--- a/ext/arybase/t/substr.t
+++ b/ext/arybase/t/substr.t
@@ -1,4 +1,4 @@
-use warnings;
+use warnings; no warnings 'deprecated';
 use strict;
 
 use Test::More tests => 6;
diff --git a/pod/perldiag.pod b/pod/perldiag.pod
index 20ee641..594d58a 100644
--- a/pod/perldiag.pod
+++ b/pod/perldiag.pod
@@ -5147,6 +5147,11 @@ you can write it as C<push(@tied_array,())> to avoid 
this warning.
 (F) The "use" keyword is recognized and executed at compile time, and
 returns no useful value.  See L<perlmod>.
 
+=item Use of assignment to $[ is deprecated
+
+(D deprecated) The C<$[> variable (index of the first element in an array)
+is deprecated. See L<perlvar/"$[">.
+
 =item Use of bare << to mean <<"" is deprecated
 
 (D deprecated) You are now encouraged to use the explicitly quoted
diff --git a/t/lib/warnings/op b/t/lib/warnings/op
index 7f00838..3797b38 100644
--- a/t/lib/warnings/op
+++ b/t/lib/warnings/op
@@ -1171,6 +1171,21 @@ Deprecated use of my() in false conditional at - line 7.
 Deprecated use of my() in false conditional at - line 8.
 ########
 # op.c
+$[ = 1;
+($[) = 1;
+use warnings 'deprecated';
+$[ = 2;
+($[) = 2;
+no warnings 'deprecated';
+$[ = 3;
+($[) = 3;
+EXPECT
+Use of assignment to $[ is deprecated at - line 2.
+Use of assignment to $[ is deprecated at - line 3.
+Use of assignment to $[ is deprecated at - line 5.
+Use of assignment to $[ is deprecated at - line 6.
+########
+# op.c
 use warnings 'void';
 @x = split /y/, "z";
 $x = split /y/, "z";
diff --git a/t/op/array_base.t b/t/op/array_base.t
index fe5045a..34404d4 100644
--- a/t/op/array_base.t
+++ b/t/op/array_base.t
@@ -1,5 +1,6 @@
 #!perl -w
 use strict;
+no warnings 'deprecated';
 
 BEGIN {
  require './test.pl';

--
Perl5 Master Repository

Reply via email to