In perl.git, the branch blead has been updated

<http://perl5.git.perl.org/perl.git/commitdiff/dd9035cd5bdeced1187df399d27d526f3b30194b?hp=4fa7c2bfe0a54ceffcc7c56cdc072eaeaf54cad9>

- Log -----------------------------------------------------------------
commit dd9035cd5bdeced1187df399d27d526f3b30194b
Author: Nicholas Clark <[email protected]>
Date:   Tue Nov 17 10:17:11 2009 +0000

    Restore strict refs on stashes, removed by ce10b5d1ec5b5f68b0811018a415bc37.
    
    Strictures on stashes were special-cased, because the lexer was 
special-cased
    to avoid autovivifying stashes (in adc51b978ed1b2e9d4512c9bfa80386ac917d05a,
    now reverted), to keep the behaviour of defined %stash:: consistent.
    
    defined %stash:: is deprecated.
    
    Keep the new regression tests from ce10b5d1ec5b5f68b0811018a415bc37bb6bfe5e.

M       op.c

commit 223f0fb7579941d15c6185ada7e98fb53bf60852
Author: Nicholas Clark <[email protected]>
Date:   Sat Oct 24 12:22:01 2009 +0100

    Re-instate the use of gv_stashpvn_flags(), and the correct non-boolean 
argument.
    
    This restores the change of 9bde8eb087a2c05d4c8b0394a59d28a09fe5f529.

M       toke.c

commit 0cc522c3af5e9943da81cc0c962abc67d3df6925
Author: Nicholas Clark <[email protected]>
Date:   Sat Oct 24 11:36:06 2009 +0100

    Remove the tokeniser hack that prevents compile-time vivification of 
%stash::
    
    This was put in to ensure that defined %stash:: continued to return false 
after
    the implementation of hashes was changed, such that stashes were always 
defined.
    defined %stash:: is deprecated.
    
    This reverts the tokeniser changes of 
adc51b978ed1b2e9d4512c9bfa80386ac917d05a,
    76138434928a968a390c791aec92e5f00017d01d,
    d6069db2e52f58ef65bf59f2fd453604270d2205 and part of
    9bde8eb087a2c05d4c8b0394a59d28a09fe5f529, and updates the tests added with 
those
    commits to reflect the restored (but as yet unreleased) behaviour.
    
    I don't think that this should be merged to blead until after 5.12.0 ships,
    with the enabled deprecation warnings on defined %hash, as it changes subtle
    behaviour that all current released stable perls accept without warning.

M       t/op/stash.t
M       toke.c
-----------------------------------------------------------------------

Summary of changes:
 op.c         |   11 -----------
 t/op/stash.t |   10 +++++-----
 toke.c       |   27 +++++----------------------
 3 files changed, 10 insertions(+), 38 deletions(-)

diff --git a/op.c b/op.c
index 3edb122..47f8300 100644
--- a/op.c
+++ b/op.c
@@ -6747,17 +6747,6 @@ Perl_ck_rvconst(pTHX_ register OP *o)
                Perl_croak(aTHX_ "Constant is not %s reference", badtype);
            return o;
        }
-       else if ((o->op_type == OP_RV2HV || o->op_type == OP_RV2SV) &&
-               (PL_hints & HINT_STRICT_REFS) && SvPOK(kidsv)) {
-           /* If this is an access to a stash, disable "strict refs", because
-            * stashes aren't auto-vivified at compile-time (unless we store
-            * symbols in them), and we don't want to produce a run-time
-            * stricture error when auto-vivifying the stash. */
-           const char *s = SvPV_nolen(kidsv);
-           const STRLEN l = SvCUR(kidsv);
-           if (l > 1 && s[l-1] == ':' && s[l-2] == ':')
-               o->op_private &= ~HINT_STRICT_REFS;
-       }
        if ((o->op_private & HINT_STRICT_REFS) && (kid->op_private & 
OPpCONST_BARE)) {
            const char *badthing;
            switch (o->op_type) {
diff --git a/t/op/stash.t b/t/op/stash.t
index 1296b8b..8eb5051 100644
--- a/t/op/stash.t
+++ b/t/op/stash.t
@@ -27,8 +27,8 @@ fresh_perl_is(
 
 {
     no warnings 'deprecated';
-    ok( !defined %oedipa::maas::, q(stashes aren't defined if not used) );
-    ok( !defined %{"oedipa::maas::"}, q(- work with hard refs too) );
+    ok( defined %oedipa::maas::, q(stashes happen to be defined if not used) );
+    ok( defined %{"oedipa::maas::"}, q(- work with hard refs too) );
 
     ok( defined %tyrone::slothrop::, q(stashes are defined if seen at compile 
time) );
     ok( defined %{"tyrone::slothrop::"}, q(- work with hard refs too) );
@@ -56,15 +56,15 @@ package main;
 
 # now tests in eval
 
-ok( !eval  { no warnings 'deprecated'; defined %achtfaden:: },   'works in 
eval{}' );
-ok( !eval q{ no warnings 'deprecated'; defined %schoenmaker:: }, 'works in 
eval("")' );
+ok( eval  { no warnings 'deprecated'; defined %achtfaden:: },   'works in 
eval{}' );
+ok( eval q{ no warnings 'deprecated'; defined %schoenmaker:: }, 'works in 
eval("")' );
 
 # now tests with strictures
 
 {
     use strict;
     no warnings 'deprecated';
-    ok( !defined %pig::, q(referencing a non-existent stash doesn't produce 
stricture errors) );
+    ok( defined %pig::, q(referencing a non-existent stash doesn't produce 
stricture errors) );
     ok( !exists $pig::{bodine}, q(referencing a non-existent stash element 
doesn't produce stricture errors) );
 }
 
diff --git a/toke.c b/toke.c
index eac007e..6cb33c1 100644
--- a/toke.c
+++ b/toke.c
@@ -8052,28 +8052,11 @@ S_pending_ident(pTHX)
     pl_yylval.opval = (OP*)newSVOP(OP_CONST, 0, newSVpvn(PL_tokenbuf + 1,
                                                      tokenbuf_len - 1));
     pl_yylval.opval->op_private = OPpCONST_ENTERED;
-    gv_fetchpvn_flags(
-           PL_tokenbuf + 1, tokenbuf_len - 1,
-           /* If the identifier refers to a stash, don't autovivify it.
-            * Change 24660 had the side effect of causing symbol table
-            * hashes to always be defined, even if they were freshly
-            * created and the only reference in the entire program was
-            * the single statement with the defined %foo::bar:: test.
-            * It appears that all code in the wild doing this actually
-            * wants to know whether sub-packages have been loaded, so
-            * by avoiding auto-vivifying symbol tables, we ensure that
-            * defined %foo::bar:: continues to be false, and the existing
-            * tests still give the expected answers, even though what
-            * they're actually testing has now changed subtly.
-            */
-           (*PL_tokenbuf == '%'
-            && *(d = PL_tokenbuf + tokenbuf_len - 1) == ':'
-            && d[-1] == ':'
-            ? 0
-            : PL_in_eval ? (GV_ADDMULTI | GV_ADDINEVAL) : GV_ADD),
-           ((PL_tokenbuf[0] == '$') ? SVt_PV
-            : (PL_tokenbuf[0] == '@') ? SVt_PVAV
-            : SVt_PVHV));
+    gv_fetchpvn_flags(PL_tokenbuf+1, tokenbuf_len - 1,
+                    PL_in_eval ? (GV_ADDMULTI | GV_ADDINEVAL) : GV_ADD,
+                    ((PL_tokenbuf[0] == '$') ? SVt_PV
+                     : (PL_tokenbuf[0] == '@') ? SVt_PVAV
+                     : SVt_PVHV));
     return WORD;
 }
 

--
Perl5 Master Repository

Reply via email to