perl

 view release on metacpan or  search on metacpan

gv.c  view on Meta::CPAN

                UV uv;
                if (!grok_atoUV(name, &uv, NULL) || uv > I32_MAX)
                    break;
                /* XXX why are we using a SSize_t? */
                paren = (SSize_t)(I32)uv;
                goto storeparen;
               }
            }
        }
    }
    else if (   stash == PL_defstash         /* Names of length 1. */
             || *name == 'a' || *name == 'b')
    {
        /* All but the above two length 1 names have to be in the main stash.
         *
         * Note that nothing failing here can apply to CORE, because the
         * minimum length (for things like 'uc') is 2. */

        switch (*name) {
          case '&':		/* $& */
            paren = RX_BUFF_IDX_FULLMATCH;
            goto sawampersand;
          case '`':		/* $` */
            paren = RX_BUFF_IDX_PREMATCH;
            goto sawampersand;
          case '\'':		/* $' */
            paren = RX_BUFF_IDX_POSTMATCH;
          sawampersand:
#ifdef PERL_SAWAMPERSAND
            if (! (   sv_type == SVt_PVAV
                   || sv_type == SVt_PVHV
                   || sv_type == SVt_PVCV
                   || sv_type == SVt_PVFM
                   || sv_type == SVt_PVIO))
            {
                PL_sawampersand |= (*name == '`') ? SAWAMPERSAND_LEFT
                                 : (*name == '&') ? SAWAMPERSAND_MIDDLE
                                 :                  SAWAMPERSAND_RIGHT;
            }
#endif
            goto storeparen;

          case '1':               /* $1 */
          case '2':               /* $2 */
          case '3':               /* $3 */
          case '4':               /* $4 */
          case '5':               /* $5 */
          case '6':               /* $6 */
          case '7':               /* $7 */
          case '8':               /* $8 */
          case '9':               /* $9 */
            paren = *name - '0';

          storeparen:
            /* Flag the capture variables with a NULL mg_ptr
               Use mg_len for the array index to lookup.  */
            sv_magic(GvSVn(gv), MUTABLE_SV(gv), PERL_MAGIC_sv, NULL, paren);
            break;

          case ':':		/* $: */
            sv_setpv(GvSVn(gv),PL_chopset);
            goto magicalize;

          case '?':		/* $? */
#ifdef COMPLEX_STATUS
            SvUPGRADE(GvSVn(gv), SVt_PVLV);
#endif
            goto magicalize;

          case '!':		/* $! */
            GvMULTI_on(gv);
            /* If %! has been used, automatically load Errno.pm. */

            sv_magic(GvSVn(gv), MUTABLE_SV(gv), PERL_MAGIC_sv, name, len);

            /* magicalization must be done before require_tie_mod_s is called */
            if (sv_type == SVt_PVHV || sv_type == SVt_PVGV)
                require_tie_mod_s(gv, '!', "Errno", 1);

            break;
          case '-':		/* $-, %-, @- */
          case '+':		/* $+, %+, @+ */
            GvMULTI_on(gv); /* no used once warnings here */
            {   /* $- $+ */
                sv_magic(GvSVn(gv), MUTABLE_SV(gv), PERL_MAGIC_sv, name, len);
                if (*name == '+')
                    SvREADONLY_NOPROTECT_on(GvSVn(gv));
            }
            {   /* %- %+ */
                if (sv_type == SVt_PVHV || sv_type == SVt_PVGV)
                    require_tie_mod_s(gv, *name, "Tie::Hash::NamedCapture",0);
            }
            {   /* @- @+ */
                AV* const av = GvAVn(gv);
                const Size_t n = *name;

                sv_magic(MUTABLE_SV(av), (SV*)n, PERL_MAGIC_regdata, NULL, 0);
                SvREADONLY_NOPROTECT_on(av);
            }
            break;
          case '*':		/* $* */
          case '#':		/* $# */
            if (sv_type == SVt_PV)
                /* diag_listed_as: $* is no longer supported as of Perl 5.30 */
                croak("$%c is no longer supported as of Perl 5.30", *name);
            break;
          case '\010':	/* $^H */
            {
                HV *const hv = GvHVn(gv);
                hv_magic(hv, NULL, PERL_MAGIC_hints);
            }
            goto magicalize;
          case '\023':	/* $^S */
          ro_magicalize:
            SvREADONLY_NOPROTECT_on(GvSVn(gv));
            /* FALLTHROUGH */
          case '0':		/* $0 */
          case '^':		/* $^ */
          case '~':		/* $~ */
          case '=':		/* $= */
          case '%':		/* $% */



( run in 1.144 second using v1.01-cache-2.11-cpan-14f38c9f855 )