summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2011-06-13 22:44:15 -0700
committerFather Chrysostomos <sprout@cpan.org>2011-06-13 22:47:30 -0700
commit9cdac2a22a8bffa5e715bb52fc23ec5f89562d4f (patch)
treeaf4860db4aa73ee44ddc5688a9dc2ff6846f5702 /gv.c
parent5cfe25fd495495a0961237ddf3346dfeb47e7137 (diff)
downloadperl-9cdac2a22a8bffa5e715bb52fc23ec5f89562d4f.tar.gz
Make $$ writable, but still magical
This commit makes $$ writable again, as it was in 5.6, while preserv- ing the magical pid-fetching added recently (post-5.14.0) by com- mit 0e219455. It does this by following Aristotle Pagaltzis’ brilliant suggestion in <20110609145148.GD8471@klangraum.plasmasturm.org>; namely, to store the PID in magic when $$ is written to, so that get-magic can detect whether a fork() has occurred and reset $$ accordingly. This makes it seem as though the fork() code sets $$ itself (which it used to before 0e219455), while even working when C code outside of perl’s control calls fork(). This restores compatibility with DBIx::Connector and PPerl.
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/gv.c b/gv.c
index f8de97f813..9bb428d40b 100644
--- a/gv.c
+++ b/gv.c
@@ -1470,9 +1470,6 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
#endif
goto magicalize;
- case '$': /* $$ */
- SvREADONLY_on(GvSVn(gv));
- goto magicalize;
case '!': /* $! */
GvMULTI_on(gv);
/* If %! has been used, automatically load Errno.pm. */
@@ -1544,6 +1541,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
case '>': /* $> */
case '\\': /* $\ */
case '/': /* $/ */
+ case '$': /* $$ */
case '\001': /* $^A */
case '\003': /* $^C */
case '\004': /* $^D */