This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Restore strict refs on stashes, removed by ce10b5d1ec5b5f68b0811018a415bc37.
authorNicholas Clark <nick@ccl4.org>
Tue, 17 Nov 2009 10:17:11 +0000 (10:17 +0000)
committerNicholas Clark <nick@ccl4.org>
Fri, 21 May 2010 20:24:35 +0000 (21:24 +0100)
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.

op.c

diff --git a/op.c b/op.c
index 3edb122..47f8300 100644 (file)
--- 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) {