This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Make $$ writable, but still magical
authorFather Chrysostomos <sprout@cpan.org>
Tue, 14 Jun 2011 05:44:15 +0000 (22:44 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Tue, 14 Jun 2011 05:47:30 +0000 (22:47 -0700)
commit9cdac2a22a8bffa5e715bb52fc23ec5f89562d4f
treeaf4860db4aa73ee44ddc5688a9dc2ff6846f5702
parent5cfe25fd495495a0961237ddf3346dfeb47e7137
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.
gv.c
mg.c
pod/perldelta.pod
t/op/magic.t