develooper Front page | perl.perl5.porters | Postings from April 2009

Deprecating $[

Thread Next
From:
James Mastros
Date:
April 2, 2009 08:01
Subject:
Deprecating $[
Message ID:
abc933c50904020726x31776ab5m192036429af16f03@mail.gmail.com
diff --git a/op.c b/op.c
index 78d9990..70efd0f 100644
--- a/op.c
+++ b/op.c
@@ -4355,6 +4355,7 @@ Perl_newASSIGNOP(pTHX_ I32 flags, OP *left, I32 optype, OP *right)
 	    PL_eval_start = 0;
 	else {
 	    if (!PL_madskills) { /* assignment to $[ is ignored when making a mad dump */
+		deprecate("assignment to $[");
 		op_free(o);
 		o = newSVOP(OP_CONST, 0, newSViv(CopARYBASE_get(&PL_compiling)));
 		o->op_private |= OPpCONST_ARYBASE;
diff --git a/pod/perlvar.pod b/pod/perlvar.pod
index 914eebe..56368d5 100644
--- a/pod/perlvar.pod
+++ b/pod/perlvar.pod
@@ -1037,8 +1037,9 @@ subscripting and when evaluating the index() and substr() functions.
 
 As of release 5 of Perl, assignment to C<$[> is treated as a compiler
 directive, and cannot influence the behavior of any other file.
-(That's why you can only assign compile-time constants to it.)
-Its use is highly discouraged.
+(That's why you can only assign compile-time constants to it.)  Its
+use is depreciated, and will trigger a warning (if the depreciation
+L<warnings> category is enabled.  You did C<use warnins>, right?)
 
 Note that, unlike other compile-time directives (such as L<strict>),
 assignment to C<$[> can be seen from outer lexical scopes in the same file.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About