diff options
author | Bo Borgerson <gigabo@gmail.com> | 2009-08-26 09:47:33 -0400 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2009-09-13 20:16:17 +0200 |
commit | a6d8037e26aaceac1a62ab1a36249ff12386c7ff (patch) | |
tree | 8698c6eca6a90d3b477aff15d1ba3c8b8f4cfd02 | |
parent | d681dfadbe84f87244e6602d414cdb00dce19f95 (diff) | |
download | perl-a6d8037e26aaceac1a62ab1a36249ff12386c7ff.tar.gz |
split: Remove implicit split to @_
Remove the long deprecated feature where split in scalar context writes to @_
-rw-r--r-- | op.c | 12 | ||||
-rw-r--r-- | pod/perldiag.pod | 6 | ||||
-rw-r--r-- | pod/perlfunc.pod | 5 | ||||
-rw-r--r-- | pp.c | 2 | ||||
-rw-r--r-- | t/lib/warnings/op | 22 | ||||
-rw-r--r-- | t/re/pat.t | 4 | ||||
-rw-r--r-- | t/run/fresh_perl.t | 4 |
7 files changed, 6 insertions, 49 deletions
@@ -872,12 +872,8 @@ Perl_scalar(pTHX_ OP *o) for (kid = cUNOPo->op_first->op_sibling; kid; kid = kid->op_sibling) scalar(kid); break; - case OP_SPLIT: - if ((kid = cLISTOPo->op_first) && kid->op_type == OP_PUSHRE) { - if (!kPMOP->op_pmreplrootu.op_pmreplroot) - deprecate_old("implicit split to @_"); - } /* FALL THROUGH */ + case OP_SPLIT: case OP_MATCH: case OP_QR: case OP_SUBST: @@ -1191,12 +1187,6 @@ Perl_scalarvoid(pTHX_ OP *o) /* FALL THROUGH */ case OP_SCALAR: return scalar(o); - case OP_SPLIT: - if ((kid = cLISTOPo->op_first) && kid->op_type == OP_PUSHRE) { - if (!kPMOP->op_pmreplrootu.op_pmreplroot) - deprecate_old("implicit split to @_"); - } - break; } if (useless && ckWARN(WARN_VOID)) Perl_warner(aTHX_ packWARN(WARN_VOID), "Useless use of %s in void context", useless); diff --git a/pod/perldiag.pod b/pod/perldiag.pod index 9447ba44f1..1f7bc0bc8e 100644 --- a/pod/perldiag.pod +++ b/pod/perldiag.pod @@ -4742,12 +4742,6 @@ to access the filehandle slot within a typeglob. operator. Since C<split> always tries to match the pattern repeatedly, the C</g> has no effect. -=item Use of implicit split to @_ is deprecated - -(D deprecated, W syntax) It makes a lot of work for the compiler when you -clobber a subroutine's argument list, so it's better if you assign the results -of a split() explicitly to an array (or list). - =item Use of inherited AUTOLOAD for non-method %s() is deprecated (D deprecated) As an (ahem) accidental feature, C<AUTOLOAD> subroutines diff --git a/pod/perlfunc.pod b/pod/perlfunc.pod index fd28b00e7e..776aaf25ef 100644 --- a/pod/perlfunc.pod +++ b/pod/perlfunc.pod @@ -5471,10 +5471,7 @@ Splits the string EXPR into a list of strings and returns that list. By default, empty leading fields are preserved, and empty trailing ones are deleted. (If all fields are empty, they are considered to be trailing.) -In scalar context, returns the number of fields found. In scalar and void -context it splits into the C<@_> array. Use of split in scalar and void -context is deprecated, however, because it clobbers your subroutine -arguments. +In scalar context, returns the number of fields found. If EXPR is omitted, splits the C<$_> string. If PATTERN is also omitted, splits on whitespace (after skipping any leading whitespace). Anything @@ -4915,8 +4915,6 @@ PP(pp_split) ary = GvAVn(pm->op_pmreplrootu.op_pmtargetgv); } #endif - else if (gimme != G_ARRAY) - ary = GvAVn(PL_defgv); else ary = NULL; if (ary && (gimme != G_ARRAY || (pm->op_pmflags & PMf_ONCE))) { diff --git a/t/lib/warnings/op b/t/lib/warnings/op index 681ec16297..0891bd8bbb 100644 --- a/t/lib/warnings/op +++ b/t/lib/warnings/op @@ -3,12 +3,6 @@ Found = in conditional, should be == 1 if $a = 1 ; - Use of implicit split to @_ is deprecated - split ; - - Use of implicit split to @_ is deprecated - $a = split ; - Useless use of time in void context Useless use of a variable in void context Useless use of a constant in void context @@ -112,22 +106,6 @@ EXPECT Found = in conditional, should be == at - line 3. ######## # op.c -use warnings 'deprecated' ; -split ; -no warnings 'deprecated' ; -split ; -EXPECT -Use of implicit split to @_ is deprecated at - line 3. -######## -# op.c -use warnings 'deprecated' ; -$a = split ; -no warnings 'deprecated' ; -$a = split ; -EXPECT -Use of implicit split to @_ is deprecated at - line 3. -######## -# op.c use warnings 'deprecated'; my (@foo, %foo); %main::foo->{"bar"}; diff --git a/t/re/pat.t b/t/re/pat.t index 4f4c6f318e..f84e07f1e2 100644 --- a/t/re/pat.t +++ b/t/re/pat.t @@ -2386,8 +2386,8 @@ sub run_tests { local $Message = "(??{ .. }) in split doesn't corrupt its stack"; our $i; ok '-1-3-5-' eq join '', split /((??{$i++}))/, '-1-3-5-'; - no warnings 'deprecated', 'syntax'; - split /(?{'WOW'})/, 'abc'; + no warnings 'syntax'; + @_ = split /(?{'WOW'})/, 'abc'; local $" = "|"; iseq "@_", "a|b|c"; } diff --git a/t/run/fresh_perl.t b/t/run/fresh_perl.t index ce9ad5a117..f22e170fc6 100644 --- a/t/run/fresh_perl.t +++ b/t/run/fresh_perl.t @@ -57,7 +57,7 @@ foreach my $prog (@prgs) { __END__ ######## -$a = ":="; split /($a)/o, "a:=b:=c"; print "@_" +$a = ":="; @_ = split /($a)/o, "a:=b:=c"; print "@_" EXPECT a := b := c ######## @@ -345,7 +345,7 @@ map {#this newline here tickles the bug $s += $_} (1,2,4); print "eat flaming death\n" unless ($s == 7); ######## -sub foo { local $_ = shift; split; @_ } +sub foo { local $_ = shift; @_ = split; @_ } @x = foo(' x y z '); print "you die joe!\n" unless "@x" eq 'x y z'; ######## |