This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Turn $$ into a magical readonly variable that always fetches getpid() instead of...
[perl5.git] / gv.c
diff --git a/gv.c b/gv.c
index 72cc9f6..a003adb 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -1469,6 +1469,9 @@ 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. */