This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Expand the comment describing the intent of change 26370, and how it
authorNicholas Clark <nick@ccl4.org>
Thu, 15 Dec 2005 17:26:22 +0000 (17:26 +0000)
committerNicholas Clark <nick@ccl4.org>
Thu, 15 Dec 2005 17:26:22 +0000 (17:26 +0000)
relates to change 24660.

p4raw-id: //depot/perl@26371

toke.c

diff --git a/toke.c b/toke.c
index eed7030..0a4452e 100644 (file)
--- a/toke.c
+++ b/toke.c
@@ -5665,7 +5665,18 @@ S_pending_ident(pTHX)
            PL_tokenbuf+1,
            PL_in_eval
                ? (GV_ADDMULTI | GV_ADDINEVAL)
-               /* if the identifier refers to a stash, don't autovivify it */
+               /* 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 + strlen(PL_tokenbuf) - 1) == ':' && d[-1] == ':'),
            ((PL_tokenbuf[0] == '$') ? SVt_PV
             : (PL_tokenbuf[0] == '@') ? SVt_PVAV