예제 #1
0
파일: gv.c 프로젝트: fduhia/metamage_1
HV*
Perl_gv_stashpvn(pTHX_ const char *name, U32 namelen, I32 create)
{
    char smallbuf[256];
    char *tmpbuf;
    HV *stash;
    GV *tmpgv;

    if (namelen + 3 < sizeof smallbuf)
	tmpbuf = smallbuf;
    else
	New(606, tmpbuf, namelen + 3, char);
    Copy(name,tmpbuf,namelen,char);
    tmpbuf[namelen++] = ':';
    tmpbuf[namelen++] = ':';
    tmpbuf[namelen] = '\0';
    tmpgv = gv_fetchpv(tmpbuf, create, SVt_PVHV);
    if (tmpbuf != smallbuf)
	Safefree(tmpbuf);
    if (!tmpgv)
	return 0;
    if (!GvHV(tmpgv))
	GvHV(tmpgv) = newHV();
    stash = GvHV(tmpgv);
    if (!HvNAME(stash))
	HvNAME(stash) = savepv(name);
    return stash;
}
예제 #2
0
파일: gv.c 프로젝트: fduhia/metamage_1
GV *
Perl_gv_HVadd(pTHX_ register GV *gv)
{
    if (!gv || SvTYPE((SV*)gv) != SVt_PVGV)
	Perl_croak(aTHX_ "Bad symbol for hash");
    if (!GvHV(gv))
	GvHV(gv) = newHV();
    return gv;
}
예제 #3
0
파일: mod_psgi.c 프로젝트: mattn/mod_psgi
static void init_perl_variables()
{
    dTHX;
    GV *exit_gv = gv_fetchpv("CORE::GLOBAL::exit", TRUE, SVt_PVCV);
    GvCV(exit_gv) = get_cv("ModPSGI::exit", TRUE);
    GvIMPORTED_CV_on(exit_gv);
    (void) hv_store(GvHV(PL_envgv), "MOD_PSGI", 8, newSVpv(MOD_PSGI_VERSION, 0), 0);
}
예제 #4
0
파일: mop.c 프로젝트: bobtfish/class-mop
void
mop_get_package_symbols (HV *stash, type_filter_t filter, get_package_symbols_cb_t cb, void *ud)
{
    HE *he;

    (void)hv_iterinit(stash);

    if (filter == TYPE_FILTER_NONE) {
        while ( (he = hv_iternext(stash)) ) {
            STRLEN keylen;
            const char *key = HePV(he, keylen);
            if (!cb(key, keylen, HeVAL(he), ud)) {
                return;
            }
        }
        return;
    }

    while ( (he = hv_iternext(stash)) ) {
        GV * const gv          = (GV*)HeVAL(he);
        STRLEN keylen;
        const char * const key = HePV(he, keylen);
        SV *sv = NULL;

        if(isGV(gv)){
            switch (filter) {
                case TYPE_FILTER_CODE:   sv = (SV *)GvCVu(gv); break;
                case TYPE_FILTER_ARRAY:  sv = (SV *)GvAV(gv);  break;
                case TYPE_FILTER_IO:     sv = (SV *)GvIO(gv);  break;
                case TYPE_FILTER_HASH:   sv = (SV *)GvHV(gv);  break;
                case TYPE_FILTER_SCALAR: sv = (SV *)GvSV(gv);  break;
                default:
                    croak("Unknown type");
            }
        }
        /* expand the gv into a real typeglob if it
        * contains stub functions or constants and we
        * were asked to return CODE references */
        else if (filter == TYPE_FILTER_CODE) {
            gv_init(gv, stash, key, keylen, GV_ADDMULTI);
            sv = (SV *)GvCV(gv);
        }

        if (sv) {
            if (!cb(key, keylen, sv, ud)) {
                return;
            }
        }
    }
}
예제 #5
0
static void
tie_it(pTHX_ const char name, UV flag, HV *const stash)
{
    GV *const gv = gv_fetchpvn(&name, 1, GV_ADDMULTI|GV_NOTQUAL, SVt_PVHV);
    HV *const hv = GvHV(gv);
    SV *rv = newSV_type(SVt_RV);

    SvRV_set(rv, newSVuv(flag));
    SvROK_on(rv);
    sv_bless(rv, stash);

    sv_unmagic((SV *)hv, PERL_MAGIC_tied);
    sv_magic((SV *)hv, rv, PERL_MAGIC_tied, NULL, 0);
    SvREFCNT_dec(rv); /* As sv_magic increased it by one.  */
}
예제 #6
0
파일: gv.c 프로젝트: fduhia/metamage_1
GV *
Perl_gv_fetchpv(pTHX_ const char *nambeg, I32 add, I32 sv_type)
{
    register const char *name = nambeg;
    register GV *gv = 0;
    GV**gvp;
    I32 len;
    register const char *namend;
    HV *stash = 0;

    if (*name == '*' && isALPHA(name[1])) /* accidental stringify on a GV? */
	name++;

    for (namend = name; *namend; namend++) {
	if ((*namend == ':' && namend[1] == ':')
	    || (*namend == '\'' && namend[1]))
	{
	    if (!stash)
		stash = PL_defstash;
	    if (!stash || !SvREFCNT(stash)) /* symbol table under destruction */
		return Nullgv;

	    len = namend - name;
	    if (len > 0) {
		char smallbuf[256];
		char *tmpbuf;

		if (len + 3 < sizeof smallbuf)
		    tmpbuf = smallbuf;
		else
		    New(601, tmpbuf, len+3, char);
		Copy(name, tmpbuf, len, char);
		tmpbuf[len++] = ':';
		tmpbuf[len++] = ':';
		tmpbuf[len] = '\0';
		gvp = (GV**)hv_fetch(stash,tmpbuf,len,add);
		gv = gvp ? *gvp : Nullgv;
		if (gv && gv != (GV*)&PL_sv_undef) {
		    if (SvTYPE(gv) != SVt_PVGV)
			gv_init(gv, stash, tmpbuf, len, (add & GV_ADDMULTI));
		    else
			GvMULTI_on(gv);
		}
		if (tmpbuf != smallbuf)
		    Safefree(tmpbuf);
		if (!gv || gv == (GV*)&PL_sv_undef)
		    return Nullgv;

		if (!(stash = GvHV(gv)))
		    stash = GvHV(gv) = newHV();

		if (!HvNAME(stash))
		    HvNAME(stash) = savepvn(nambeg, namend - nambeg);
	    }

	    if (*namend == ':')
		namend++;
	    namend++;
	    name = namend;
	    if (!*name)
		return gv ? gv : (GV*)*hv_fetch(PL_defstash, "main::", 6, TRUE);
	}
    }
예제 #7
0
파일: taint.c 프로젝트: andreisoltan/csc469
void
Perl_taint_env(pTHX)
{
    SV** svp;
    MAGIC* mg;
    char** e;
    static char* misc_env[] = {
	"IFS",		/* most shells' inter-field separators */
	"CDPATH",	/* ksh dain bramage #1 */
	"ENV",		/* ksh dain bramage #2 */
	"BASH_ENV",	/* bash dain bramage -- I guess it's contagious */
	NULL
    };

    /* Don't bother if there's no *ENV glob */
    if (!PL_envgv)
	return;
    /* If there's no %ENV hash of if it's not magical, croak, because
     * it probably doesn't reflect the actual environment */
    if (!GvHV(PL_envgv) || !(SvRMAGICAL(GvHV(PL_envgv))
	    && mg_find((SV*)GvHV(PL_envgv), PERL_MAGIC_env))) {
	bool was_tainted = PL_tainted;
	char *name = GvENAME(PL_envgv);
	PL_tainted = TRUE;
	if (strEQ(name,"ENV"))
	    /* hash alias */
	    taint_proper("%%ENV is aliased to %s%s", "another variable");
	else
	    /* glob alias: report it in the error message */
	    taint_proper("%%ENV is aliased to %%%s%s", name);
	/* this statement is reached under -t or -U */
	PL_tainted = was_tainted;
    }

#ifdef VMS
    {
    int i = 0;
    char name[10 + TYPE_DIGITS(int)] = "DCL$PATH";

    while (1) {
	if (i)
	    (void)sprintf(name,"DCL$PATH;%d", i);
	svp = hv_fetch(GvHVn(PL_envgv), name, strlen(name), FALSE);
	if (!svp || *svp == &PL_sv_undef)
	    break;
	if (SvTAINTED(*svp)) {
	    TAINT;
	    taint_proper("Insecure %s%s", "$ENV{DCL$PATH}");
	}
	if ((mg = mg_find(*svp, PERL_MAGIC_envelem)) && MgTAINTEDDIR(mg)) {
	    TAINT;
	    taint_proper("Insecure directory in %s%s", "$ENV{DCL$PATH}");
	}
	i++;
    }
  }
#endif /* VMS */

    svp = hv_fetch(GvHVn(PL_envgv),"PATH",4,FALSE);
    if (svp && *svp) {
	if (SvTAINTED(*svp)) {
	    TAINT;
	    taint_proper("Insecure %s%s", "$ENV{PATH}");
	}
	if ((mg = mg_find(*svp, PERL_MAGIC_envelem)) && MgTAINTEDDIR(mg)) {
	    TAINT;
	    taint_proper("Insecure directory in %s%s", "$ENV{PATH}");
	}
    }

#ifndef VMS
    /* tainted $TERM is okay if it contains no metachars */
    svp = hv_fetch(GvHVn(PL_envgv),"TERM",4,FALSE);
    if (svp && *svp && SvTAINTED(*svp)) {
	STRLEN n_a;
	bool was_tainted = PL_tainted;
	char *t = SvPV(*svp, n_a);
	char *e = t + n_a;
	PL_tainted = was_tainted;
	if (t < e && isALNUM(*t))
	    t++;
	while (t < e && (isALNUM(*t) || strchr("-_.+", *t)))
	    t++;
	if (t < e) {
	    TAINT;
	    taint_proper("Insecure $ENV{%s}%s", "TERM");
	}
    }
#endif /* !VMS */

    for (e = misc_env; *e; e++) {
	svp = hv_fetch(GvHVn(PL_envgv), *e, strlen(*e), FALSE);
	if (svp && *svp != &PL_sv_undef && SvTAINTED(*svp)) {
	    TAINT;
	    taint_proper("Insecure $ENV{%s}%s", *e);
	}
    }
}
예제 #8
0
static int perl_init_aaaa()
{
	dTARG;
	dSP;
	listop_list[0].op_ppaddr = PL_ppaddr[OP_LEAVE];
	op_list[0].op_ppaddr = PL_ppaddr[OP_ENTER];
	cop_list[0].op_ppaddr = PL_ppaddr[OP_NEXTSTATE];
	cop_list[0].cop_warnings = pWARN_STD;
	CopFILE_set(&cop_list[0], "hello.p");
	CopSTASHPV_set(&cop_list[0], "main");
	listop_list[1].op_ppaddr = PL_ppaddr[OP_PRINT];
	op_list[1].op_ppaddr = PL_ppaddr[OP_PUSHMARK];
	svop_list[0].op_ppaddr = PL_ppaddr[OP_CONST];
	gv_list[0] = gv_fetchpv("main::/", TRUE, SVt_PV);
	SvFLAGS(gv_list[0]) = 0x600d;
	GvFLAGS(gv_list[0]) = 0xa;
	GvLINE(gv_list[0]) = 0;
	SvPVX(gv_list[0]) = emptystring;

	SvREFCNT(gv_list[0]) += 4;
	GvREFCNT(gv_list[0]) += 1;
	gv_list[1] = gv_fetchpv("main::stderr", TRUE, SVt_PV);
	SvFLAGS(gv_list[1]) = 0x600d;
	GvFLAGS(gv_list[1]) = 0x2;
	GvLINE(gv_list[1]) = 0;
	SvPVX(gv_list[1]) = emptystring;

	SvREFCNT(gv_list[1]) += 2;
	GvREFCNT(gv_list[1]) += 1;
	GvSV(gv_list[1]) = &sv_list[0];
	GvFILE(gv_list[1]) = "hello.p";
	IoIFP((IO*)&sv_list[1])=PerlIO_stderr();
	IoOFP((IO*)&sv_list[1])=PerlIO_stderr();
	hv0 = gv_stashpv("FileHandle", TRUE);
	SvSTASH((IO*)&sv_list[1]) = hv0;
	GvIOp(gv_list[1]) = (IO*)&sv_list[1];
	gv_list[2] = gv_fetchpv("main::SIG", TRUE, SVt_PV);
	SvFLAGS(gv_list[2]) = 0x600d;
	GvFLAGS(gv_list[2]) = 0xa;
	GvLINE(gv_list[2]) = 62;
	SvPVX(gv_list[2]) = emptystring;

	SvREFCNT(gv_list[2]) += 12;
	GvREFCNT(gv_list[2]) += 1;
	gv_list[3] = gv_fetchpv("main::,", TRUE, SVt_PV);
	SvFLAGS(gv_list[3]) = 0x600d;
	GvFLAGS(gv_list[3]) = 0xa;
	GvLINE(gv_list[3]) = 474;
	SvPVX(gv_list[3]) = emptystring;

	SvREFCNT(gv_list[3]) += 6;
	GvREFCNT(gv_list[3]) += 1;
	gv_list[4] = gv_fetchpv("utf8::unicode_to_native", TRUE, SVt_PV);
	SvFLAGS(gv_list[4]) = 0x600d;
	GvFLAGS(gv_list[4]) = 0xa;
	GvLINE(gv_list[4]) = 0;
	SvPVX(gv_list[4]) = emptystring;

	SvREFCNT(gv_list[4]) += 3;
	GvREFCNT(gv_list[4]) += 1;
	GvSV(gv_list[4]) = &sv_list[2];
	GvCV(gv_list[4]) = (CV*)((perl_get_cv("utf8::unicode_to_native",TRUE)));
	GvFILE(gv_list[4]) = "hello.p";
	gv_list[5] = gv_fetchpv("utf8::encode", TRUE, SVt_PV);
	SvFLAGS(gv_list[5]) = 0x600d;
	GvFLAGS(gv_list[5]) = 0x2;
	GvLINE(gv_list[5]) = 0;
	SvPVX(gv_list[5]) = emptystring;

	SvREFCNT(gv_list[5]) += 2;
	GvREFCNT(gv_list[5]) += 1;
	GvSV(gv_list[5]) = &sv_list[3];
	GvCV(gv_list[5]) = (CV*)((perl_get_cv("utf8::encode",TRUE)));
	GvFILE(gv_list[5]) = "hello.p";
	gv_list[6] = gv_fetchpv("utf8::valid", TRUE, SVt_PV);
	SvFLAGS(gv_list[6]) = 0x600d;
	GvFLAGS(gv_list[6]) = 0x2;
	GvLINE(gv_list[6]) = 0;
	SvPVX(gv_list[6]) = emptystring;

	SvREFCNT(gv_list[6]) += 2;
	GvREFCNT(gv_list[6]) += 1;
	GvSV(gv_list[6]) = &sv_list[4];
	GvCV(gv_list[6]) = (CV*)((perl_get_cv("utf8::valid",TRUE)));
	GvFILE(gv_list[6]) = "hello.p";
	gv_list[7] = gv_fetchpv("utf8::native_to_unicode", TRUE, SVt_PV);
	SvFLAGS(gv_list[7]) = 0x600d;
	GvFLAGS(gv_list[7]) = 0x2;
	GvLINE(gv_list[7]) = 0;
	SvPVX(gv_list[7]) = emptystring;

	SvREFCNT(gv_list[7]) += 2;
	GvREFCNT(gv_list[7]) += 1;
	GvSV(gv_list[7]) = &sv_list[5];
	GvCV(gv_list[7]) = (CV*)((perl_get_cv("utf8::native_to_unicode",TRUE)));
	GvFILE(gv_list[7]) = "hello.p";
	gv_list[8] = gv_fetchpv("utf8::decode", TRUE, SVt_PV);
	SvFLAGS(gv_list[8]) = 0x600d;
	GvFLAGS(gv_list[8]) = 0x2;
	GvLINE(gv_list[8]) = 0;
	SvPVX(gv_list[8]) = emptystring;

	SvREFCNT(gv_list[8]) += 2;
	GvREFCNT(gv_list[8]) += 1;
	GvSV(gv_list[8]) = &sv_list[6];
	GvCV(gv_list[8]) = (CV*)((perl_get_cv("utf8::decode",TRUE)));
	GvFILE(gv_list[8]) = "hello.p";
	gv_list[9] = gv_fetchpv("utf8::downgrade", TRUE, SVt_PV);
	SvFLAGS(gv_list[9]) = 0x600d;
	GvFLAGS(gv_list[9]) = 0x2;
	GvLINE(gv_list[9]) = 0;
	SvPVX(gv_list[9]) = emptystring;

	SvREFCNT(gv_list[9]) += 2;
	GvREFCNT(gv_list[9]) += 1;
	GvSV(gv_list[9]) = &sv_list[7];
	GvCV(gv_list[9]) = (CV*)((perl_get_cv("utf8::downgrade",TRUE)));
	GvFILE(gv_list[9]) = "hello.p";
	gv_list[10] = gv_fetchpv("utf8::upgrade", TRUE, SVt_PV);
	SvFLAGS(gv_list[10]) = 0x600d;
	GvFLAGS(gv_list[10]) = 0x2;
	GvLINE(gv_list[10]) = 0;
	SvPVX(gv_list[10]) = emptystring;

	SvREFCNT(gv_list[10]) += 2;
	GvREFCNT(gv_list[10]) += 1;
	GvSV(gv_list[10]) = &sv_list[8];
	GvCV(gv_list[10]) = (CV*)((perl_get_cv("utf8::upgrade",TRUE)));
	GvFILE(gv_list[10]) = "hello.p";
	gv_list[11] = gv_fetchpv("utf8::is_utf8", TRUE, SVt_PV);
	SvFLAGS(gv_list[11]) = 0x600d;
	GvFLAGS(gv_list[11]) = 0x2;
	GvLINE(gv_list[11]) = 0;
	SvPVX(gv_list[11]) = emptystring;

	SvREFCNT(gv_list[11]) += 2;
	GvREFCNT(gv_list[11]) += 1;
	GvSV(gv_list[11]) = &sv_list[9];
	GvCV(gv_list[11]) = (CV*)((perl_get_cv("utf8::is_utf8",TRUE)));
	GvFILE(gv_list[11]) = "hello.p";
	gv_list[12] = gv_fetchpv("main::\"", TRUE, SVt_PV);
	SvFLAGS(gv_list[12]) = 0x600d;
	GvFLAGS(gv_list[12]) = 0xa;
	GvLINE(gv_list[12]) = 0;
	SvPVX(gv_list[12]) = emptystring;

	SvREFCNT(gv_list[12]) += 10;
	GvREFCNT(gv_list[12]) += 1;
	gv_list[13] = gv_fetchpv("main::stdout", TRUE, SVt_PV);
	SvFLAGS(gv_list[13]) = 0x600d;
	GvFLAGS(gv_list[13]) = 0x2;
	GvLINE(gv_list[13]) = 0;
	SvPVX(gv_list[13]) = emptystring;

	SvREFCNT(gv_list[13]) += 2;
	GvREFCNT(gv_list[13]) += 1;
	GvSV(gv_list[13]) = &sv_list[10];
	GvFILE(gv_list[13]) = "hello.p";
	IoIFP((IO*)&sv_list[11])=PerlIO_stdout();
	IoOFP((IO*)&sv_list[11])=PerlIO_stdout();
	SvSTASH((IO*)&sv_list[11]) = hv0;
	GvIOp(gv_list[13]) = (IO*)&sv_list[11];
	gv_list[14] = gv_fetchpv("main::\022", TRUE, SVt_PV);
	SvFLAGS(gv_list[14]) = 0x600d;
	GvFLAGS(gv_list[14]) = 0x2;
	GvLINE(gv_list[14]) = 0;
	SvPVX(gv_list[14]) = emptystring;

	SvREFCNT(gv_list[14]) += 2;
	GvREFCNT(gv_list[14]) += 1;
	gv_list[15] = gv_fetchpv("main::|", TRUE, SVt_PV);
	SvFLAGS(gv_list[15]) = 0x600d;
	GvFLAGS(gv_list[15]) = 0xa;
	GvLINE(gv_list[15]) = 466;
	SvPVX(gv_list[15]) = emptystring;

	SvREFCNT(gv_list[15]) += 5;
	GvREFCNT(gv_list[15]) += 1;
	gv_list[16] = gv_fetchpv("Regexp::DESTROY", TRUE, SVt_PV);
	SvFLAGS(gv_list[16]) = 0x600d;
	GvFLAGS(gv_list[16]) = 0x2;
	GvLINE(gv_list[16]) = 0;
	SvPVX(gv_list[16]) = emptystring;

	SvREFCNT(gv_list[16]) += 2;
	GvREFCNT(gv_list[16]) += 1;
	GvSV(gv_list[16]) = &sv_list[12];
	GvCV(gv_list[16]) = (CV*)((perl_get_cv("Regexp::DESTROY",TRUE)));
	GvFILE(gv_list[16]) = "hello.p";
	gv_list[17] = gv_fetchpv("main::\f", TRUE, SVt_PV);
	SvFLAGS(gv_list[17]) = 0x600d;
	GvFLAGS(gv_list[17]) = 0xa;
	GvLINE(gv_list[17]) = 554;
	SvPVX(gv_list[17]) = emptystring;

	SvREFCNT(gv_list[17]) += 4;
	GvREFCNT(gv_list[17]) += 1;
	gv_list[18] = gv_fetchpv("main::^", TRUE, SVt_PV);
	SvFLAGS(gv_list[18]) = 0x600d;
	GvFLAGS(gv_list[18]) = 0xa;
	GvLINE(gv_list[18]) = 538;
	SvPVX(gv_list[18]) = emptystring;

	SvREFCNT(gv_list[18]) += 4;
	GvREFCNT(gv_list[18]) += 1;
	gv_list[19] = gv_fetchpv("main::\001", TRUE, SVt_PV);
	SvFLAGS(gv_list[19]) = 0x600d;
	GvFLAGS(gv_list[19]) = 0xa;
	GvLINE(gv_list[19]) = 562;
	SvPVX(gv_list[19]) = emptystring;

	SvREFCNT(gv_list[19]) += 5;
	GvREFCNT(gv_list[19]) += 1;
	gv_list[20] = gv_fetchpv("main::$", TRUE, SVt_PV);
	SvFLAGS(gv_list[20]) = 0x600d;
	GvFLAGS(gv_list[20]) = 0x2;
	GvLINE(gv_list[20]) = 0;
	SvPVX(gv_list[20]) = emptystring;

	SvREFCNT(gv_list[20]) += 2;
	GvREFCNT(gv_list[20]) += 1;
	gv_list[21] = gv_fetchpv("main::\\", TRUE, SVt_PV);
	SvFLAGS(gv_list[21]) = 0x600d;
	GvFLAGS(gv_list[21]) = 0xa;
	GvLINE(gv_list[21]) = 441;
	SvPVX(gv_list[21]) = emptystring;

	SvREFCNT(gv_list[21]) += 9;
	GvREFCNT(gv_list[21]) += 1;
	gv_list[22] = gv_fetchpv("main::_</usr/lib/perl5/5.8.5/i386-linux-thread-multi/XSLoader.pm", TRUE, SVt_PV);
	SvFLAGS(gv_list[22]) = 0x600d;
	GvFLAGS(gv_list[22]) = 0x2;
	GvLINE(gv_list[22]) = 4294967295;
	SvPVX(gv_list[22]) = emptystring;

	SvREFCNT(gv_list[22]) += 2;
	GvREFCNT(gv_list[22]) += 1;
	xpv_list[0].xpv_pv = savepvn("/usr/lib/perl5/5.8.5/i386-linux-thread-multi/XSLoader.pm", 56);
	GvSV(gv_list[22]) = &sv_list[13];
	GvFILE(gv_list[22]) = "/usr/lib/perl5/5.8.5/i386-linux-thread-multi/XSLoader.pm";
	gv_list[23] = gv_fetchpv("main::~", TRUE, SVt_PV);
	SvFLAGS(gv_list[23]) = 0x600d;
	GvFLAGS(gv_list[23]) = 0xa;
	GvLINE(gv_list[23]) = 530;
	SvPVX(gv_list[23]) = emptystring;

	SvREFCNT(gv_list[23]) += 4;
	GvREFCNT(gv_list[23]) += 1;
	gv_list[24] = gv_fetchpv("main::-", TRUE, SVt_PV);
	SvFLAGS(gv_list[24]) = 0x600d;
	GvFLAGS(gv_list[24]) = 0xa;
	GvLINE(gv_list[24]) = 0;
	SvPVX(gv_list[24]) = emptystring;

	SvREFCNT(gv_list[24]) += 4;
	GvREFCNT(gv_list[24]) += 1;
	gv_list[25] = gv_fetchpv("main::_<perlmain.c", TRUE, SVt_PV);
	SvFLAGS(gv_list[25]) = 0x600d;
	GvFLAGS(gv_list[25]) = 0x2;
	GvLINE(gv_list[25]) = 0;
	SvPVX(gv_list[25]) = emptystring;

	SvREFCNT(gv_list[25]) += 2;
	GvREFCNT(gv_list[25]) += 1;
	xpv_list[1].xpv_pv = savepvn("perlmain.c", 10);
	GvSV(gv_list[25]) = &sv_list[14];
	GvFILE(gv_list[25]) = "hello.p";
	gv_list[26] = gv_fetchpv("main::_</usr/lib/perl5/5.8.5/File/Spec/Unix.pm", TRUE, SVt_PV);
	SvFLAGS(gv_list[26]) = 0x600d;
	GvFLAGS(gv_list[26]) = 0x2;
	GvLINE(gv_list[26]) = 98;
	SvPVX(gv_list[26]) = emptystring;

	SvREFCNT(gv_list[26]) += 2;
	GvREFCNT(gv_list[26]) += 1;
	xpv_list[2].xpv_pv = savepvn("/usr/lib/perl5/5.8.5/File/Spec/Unix.pm", 38);
	GvSV(gv_list[26]) = &sv_list[15];
	GvFILE(gv_list[26]) = "x/\031\b q\024\b\332T\305";
	gv_list[27] = gv_fetchpv("main::_</usr/lib/perl5/5.8.5/i386-linux-thread-multi/auto/B/C/C.so", TRUE, SVt_PV);
	SvFLAGS(gv_list[27]) = 0x600d;
	GvFLAGS(gv_list[27]) = 0x2;
	GvLINE(gv_list[27]) = 87;
	SvPVX(gv_list[27]) = emptystring;

	SvREFCNT(gv_list[27]) += 2;
	GvREFCNT(gv_list[27]) += 1;
	xpv_list[3].xpv_pv = savepvn("/usr/lib/perl5/5.8.5/i386-linux-thread-multi/auto/B/C/C.so", 58);
	GvSV(gv_list[27]) = &sv_list[16];
	GvFILE(gv_list[27]) = "/usr/lib/perl5/5.8.5/i386-linux-thread-multi/XSLoader.pm";
	gv_list[28] = gv_fetchpv("main::_<universal.c", TRUE, SVt_PV);
	SvFLAGS(gv_list[28]) = 0x600d;
	GvFLAGS(gv_list[28]) = 0x2;
	GvLINE(gv_list[28]) = 0;
	SvPVX(gv_list[28]) = emptystring;

	SvREFCNT(gv_list[28]) += 2;
	GvREFCNT(gv_list[28]) += 1;
	xpv_list[4].xpv_pv = savepvn("universal.c", 11);
	GvSV(gv_list[28]) = &sv_list[17];
	GvFILE(gv_list[28]) = "hello.p";
	gv_list[29] = gv_fetchpv("main::BEGIN", TRUE, SVt_PV);
	SvFLAGS(gv_list[29]) = 0x600d;
	GvFLAGS(gv_list[29]) = 0x2;
	GvLINE(gv_list[29]) = 0;
	SvPVX(gv_list[29]) = emptystring;

	SvREFCNT(gv_list[29]) += 2;
	GvREFCNT(gv_list[29]) += 1;
	GvSV(gv_list[29]) = &sv_list[18];
	GvFILE(gv_list[29]) = "hello.p";
	gv_list[30] = gv_fetchpv("main::_<xsutils.c", TRUE, SVt_PV);
	SvFLAGS(gv_list[30]) = 0x600d;
	GvFLAGS(gv_list[30]) = 0x2;
	GvLINE(gv_list[30]) = 0;
	SvPVX(gv_list[30]) = emptystring;

	SvREFCNT(gv_list[30]) += 2;
	GvREFCNT(gv_list[30]) += 1;
	xpv_list[5].xpv_pv = savepvn("xsutils.c", 9);
	GvSV(gv_list[30]) = &sv_list[19];
	GvFILE(gv_list[30]) = "hello.p";
	gv_list[31] = gv_fetchpv("main::!", TRUE, SVt_PV);
	SvFLAGS(gv_list[31]) = 0x600d;
	GvFLAGS(gv_list[31]) = 0xa;
	GvLINE(gv_list[31]) = 2054;
	SvPVX(gv_list[31]) = emptystring;

	SvREFCNT(gv_list[31]) += 3;
	GvREFCNT(gv_list[31]) += 1;
	GvFILE(gv_list[31]) = "";
	gv_list[32] = gv_fetchpv("main::\024AINT", TRUE, SVt_PV);
	SvFLAGS(gv_list[32]) = 0x600d;
	GvFLAGS(gv_list[32]) = 0xa;
	GvLINE(gv_list[32]) = 1589;
	SvPVX(gv_list[32]) = emptystring;

	SvREFCNT(gv_list[32]) += 3;
	GvREFCNT(gv_list[32]) += 1;
	sv_magic((SV*)&sv_list[20], (SV*)gv_list[32], '\000', "\024AINT", 5);
	GvSV(gv_list[32]) = &sv_list[20];
	GvFILE(gv_list[32]) = "";
	gv_list[33] = gv_fetchpv("main::\017", TRUE, SVt_PV);
	SvFLAGS(gv_list[33]) = 0x600d;
	GvFLAGS(gv_list[33]) = 0xa;
	GvLINE(gv_list[33]) = 55;
	SvPVX(gv_list[33]) = emptystring;

	SvREFCNT(gv_list[33]) += 4;
	GvREFCNT(gv_list[33]) += 1;
	gv_list[34] = gv_fetchpv("main::%", TRUE, SVt_PV);
	SvFLAGS(gv_list[34]) = 0x600d;
	GvFLAGS(gv_list[34]) = 0xa;
	GvLINE(gv_list[34]) = 506;
	SvPVX(gv_list[34]) = emptystring;

	SvREFCNT(gv_list[34]) += 4;
	GvREFCNT(gv_list[34]) += 1;
	gv_list[35] = gv_fetchpv("main::\030", TRUE, SVt_PV);
	SvFLAGS(gv_list[35]) = 0x600d;
	GvFLAGS(gv_list[35]) = 0x2;
	GvLINE(gv_list[35]) = 0;
	SvPVX(gv_list[35]) = emptystring;

	SvREFCNT(gv_list[35]) += 2;
	GvREFCNT(gv_list[35]) += 1;
	gv_list[36] = gv_fetchpv("main::_", TRUE, SVt_PV);
	SvFLAGS(gv_list[36]) = 0x630d;
	GvFLAGS(gv_list[36]) = 0xa;
	GvLINE(gv_list[36]) = 0;
	SvPVX(gv_list[36]) = emptystring;

	SvREFCNT(gv_list[36]) += 470;
	GvREFCNT(gv_list[36]) += 1;
	gv_list[37] = gv_fetchpv("main::+", TRUE, SVt_PV);
	SvFLAGS(gv_list[37]) = 0x600d;
	GvFLAGS(gv_list[37]) = 0x2;
	GvLINE(gv_list[37]) = 0;
	SvPVX(gv_list[37]) = emptystring;

	SvREFCNT(gv_list[37]) += 2;
	GvREFCNT(gv_list[37]) += 1;
	gv_list[38] = gv_fetchpv("Internals::SvREFCNT", TRUE, SVt_PV);
	SvFLAGS(gv_list[38]) = 0x600d;
	GvFLAGS(gv_list[38]) = 0x2;
	GvLINE(gv_list[38]) = 0;
	SvPVX(gv_list[38]) = emptystring;

	SvREFCNT(gv_list[38]) += 2;
	GvREFCNT(gv_list[38]) += 1;
	GvSV(gv_list[38]) = &sv_list[21];
	GvCV(gv_list[38]) = (CV*)((perl_get_cv("Internals::SvREFCNT",TRUE)));
	GvFILE(gv_list[38]) = "hello.p";
	gv_list[39] = gv_fetchpv("Internals::hv_clear_placeholders", TRUE, SVt_PV);
	SvFLAGS(gv_list[39]) = 0x600d;
	GvFLAGS(gv_list[39]) = 0x2;
	GvLINE(gv_list[39]) = 0;
	SvPVX(gv_list[39]) = emptystring;

	SvREFCNT(gv_list[39]) += 2;
	GvREFCNT(gv_list[39]) += 1;
	GvSV(gv_list[39]) = &sv_list[22];
	GvCV(gv_list[39]) = (CV*)((perl_get_cv("Internals::hv_clear_placeholders",TRUE)));
	GvFILE(gv_list[39]) = "hello.p";
	gv_list[40] = gv_fetchpv("Internals::hash_seed", TRUE, SVt_PV);
	SvFLAGS(gv_list[40]) = 0x600d;
	GvFLAGS(gv_list[40]) = 0x2;
	GvLINE(gv_list[40]) = 0;
	SvPVX(gv_list[40]) = emptystring;

	SvREFCNT(gv_list[40]) += 2;
	GvREFCNT(gv_list[40]) += 1;
	GvSV(gv_list[40]) = &sv_list[23];
	GvCV(gv_list[40]) = (CV*)((perl_get_cv("Internals::hash_seed",TRUE)));
	GvFILE(gv_list[40]) = "hello.p";
	gv_list[41] = gv_fetchpv("Internals::SvREADONLY", TRUE, SVt_PV);
	SvFLAGS(gv_list[41]) = 0x600d;
	GvFLAGS(gv_list[41]) = 0x2;
	GvLINE(gv_list[41]) = 0;
	SvPVX(gv_list[41]) = emptystring;

	SvREFCNT(gv_list[41]) += 2;
	GvREFCNT(gv_list[41]) += 1;
	GvSV(gv_list[41]) = &sv_list[24];
	GvCV(gv_list[41]) = (CV*)((perl_get_cv("Internals::SvREADONLY",TRUE)));
	GvFILE(gv_list[41]) = "hello.p";
	gv_list[42] = gv_fetchpv("Internals::HvREHASH", TRUE, SVt_PV);
	SvFLAGS(gv_list[42]) = 0x600d;
	GvFLAGS(gv_list[42]) = 0x2;
	GvLINE(gv_list[42]) = 0;
	SvPVX(gv_list[42]) = emptystring;

	SvREFCNT(gv_list[42]) += 2;
	GvREFCNT(gv_list[42]) += 1;
	GvSV(gv_list[42]) = &sv_list[25];
	GvCV(gv_list[42]) = (CV*)((perl_get_cv("Internals::HvREHASH",TRUE)));
	GvFILE(gv_list[42]) = "hello.p";
	gv_list[43] = gv_fetchpv("Internals::rehash_seed", TRUE, SVt_PV);
	SvFLAGS(gv_list[43]) = 0x600d;
	GvFLAGS(gv_list[43]) = 0x2;
	GvLINE(gv_list[43]) = 0;
	SvPVX(gv_list[43]) = emptystring;

	SvREFCNT(gv_list[43]) += 2;
	GvREFCNT(gv_list[43]) += 1;
	GvSV(gv_list[43]) = &sv_list[26];
	GvCV(gv_list[43]) = (CV*)((perl_get_cv("Internals::rehash_seed",TRUE)));
	GvFILE(gv_list[43]) = "hello.p";
	gv_list[44] = gv_fetchpv("main::STDIN", TRUE, SVt_PV);
	SvFLAGS(gv_list[44]) = 0x600d;
	GvFLAGS(gv_list[44]) = 0xa;
	GvLINE(gv_list[44]) = 0;
	SvPVX(gv_list[44]) = emptystring;

	SvREFCNT(gv_list[44]) += 2;
	GvREFCNT(gv_list[44]) += 1;
	gv_list[45] = gv_fetchpv("DB::args", TRUE, SVt_PV);
	SvFLAGS(gv_list[45]) = 0x600d;
	GvFLAGS(gv_list[45]) = 0xa;
	GvLINE(gv_list[45]) = 431;
	SvPVX(gv_list[45]) = emptystring;

	SvREFCNT(gv_list[45]) += 4;
	GvREFCNT(gv_list[45]) += 1;
	GvSV(gv_list[45]) = &sv_list[27];
	GvAV(gv_list[45]) = (AV*)&sv_list[28];
	GvFILE(gv_list[45]) = "\260\r\016\b";
	gv_list[46] = gv_fetchpv("main::\026", TRUE, SVt_PV);
	SvFLAGS(gv_list[46]) = 0x600d;
	GvFLAGS(gv_list[46]) = 0xa;
	GvLINE(gv_list[46]) = 30;
	SvPVX(gv_list[46]) = emptystring;

	SvREFCNT(gv_list[46]) += 2;
	GvREFCNT(gv_list[46]) += 1;
	gv_list[47] = gv_fetchpv("main::=", TRUE, SVt_PV);
	SvFLAGS(gv_list[47]) = 0x600d;
	GvFLAGS(gv_list[47]) = 0xa;
	GvLINE(gv_list[47]) = 514;
	SvPVX(gv_list[47]) = emptystring;

	SvREFCNT(gv_list[47]) += 4;
	GvREFCNT(gv_list[47]) += 1;
	gv_list[48] = gv_fetchpv("main::2", TRUE, SVt_PV);
	SvFLAGS(gv_list[48]) = 0x600d;
	GvFLAGS(gv_list[48]) = 0xa;
	GvLINE(gv_list[48]) = 257;
	SvPVX(gv_list[48]) = emptystring;

	SvREFCNT(gv_list[48]) += 6;
	GvREFCNT(gv_list[48]) += 1;
	gv_list[49] = gv_fetchpv("main::_<Fcntl.c", TRUE, SVt_PV);
	SvFLAGS(gv_list[49]) = 0x600d;
	GvFLAGS(gv_list[49]) = 0x2;
	GvLINE(gv_list[49]) = 92;
	SvPVX(gv_list[49]) = emptystring;

	SvREFCNT(gv_list[49]) += 2;
	GvREFCNT(gv_list[49]) += 1;
	xpv_list[6].xpv_pv = savepvn("Fcntl.c", 7);
	GvSV(gv_list[49]) = &sv_list[29];
	GvFILE(gv_list[49]) = "/usr/lib/perl5/5.8.5/i386-linux-thread-multi/XSLoader.pm";
	gv_list[50] = gv_fetchpv("main::1", TRUE, SVt_PV);
	SvFLAGS(gv_list[50]) = 0x600d;
	GvFLAGS(gv_list[50]) = 0xa;
	GvLINE(gv_list[50]) = 74;
	SvPVX(gv_list[50]) = emptystring;

	SvREFCNT(gv_list[50]) += 28;
	GvREFCNT(gv_list[50]) += 1;
	gv_list[51] = gv_fetchpv("main::_<IO.c", TRUE, SVt_PV);
	SvFLAGS(gv_list[51]) = 0x600d;
	GvFLAGS(gv_list[51]) = 0x2;
	GvLINE(gv_list[51]) = 92;
	SvPVX(gv_list[51]) = emptystring;

	SvREFCNT(gv_list[51]) += 2;
	GvREFCNT(gv_list[51]) += 1;
	xpv_list[7].xpv_pv = savepvn("IO.c", 4);
	GvSV(gv_list[51]) = &sv_list[30];
	GvFILE(gv_list[51]) = "/usr/lib/perl5/5.8.5/i386-linux-thread-multi/XSLoader.pm";
	gv_list[52] = gv_fetchpv("main::\027ARNING_BITS", TRUE, SVt_PV);
	SvFLAGS(gv_list[52]) = 0x600d;
	GvFLAGS(gv_list[52]) = 0xa;
	GvLINE(gv_list[52]) = 341;
	SvPVX(gv_list[52]) = emptystring;

	SvREFCNT(gv_list[52]) += 6;
	GvREFCNT(gv_list[52]) += 1;
	sv_magic((SV*)&sv_list[31], (SV*)gv_list[52], '\000', "\027ARNING_BITS", 12);
	GvSV(gv_list[52]) = &sv_list[31];
	GvFILE(gv_list[52]) = "\260\r\016\b";
	gv_list[53] = gv_fetchpv("main::_<B.c", TRUE, SVt_PV);
	SvFLAGS(gv_list[53]) = 0x600d;
	GvFLAGS(gv_list[53]) = 0x2;
	GvLINE(gv_list[53]) = 92;
	SvPVX(gv_list[53]) = emptystring;

	SvREFCNT(gv_list[53]) += 2;
	GvREFCNT(gv_list[53]) += 1;
	xpv_list[8].xpv_pv = savepvn("B.c", 3);
	GvSV(gv_list[53]) = &sv_list[32];
	GvFILE(gv_list[53]) = "/usr/lib/perl5/5.8.5/i386-linux-thread-multi/XSLoader.pm";
	gv_list[54] = gv_fetchpv("main::_<DynaLoader.c", TRUE, SVt_PV);
	SvFLAGS(gv_list[54]) = 0x600d;
	GvFLAGS(gv_list[54]) = 0x2;
	GvLINE(gv_list[54]) = 16;
	SvPVX(gv_list[54]) = emptystring;

	SvREFCNT(gv_list[54]) += 2;
	GvREFCNT(gv_list[54]) += 1;
	xpv_list[9].xpv_pv = savepvn("DynaLoader.c", 12);
	GvSV(gv_list[54]) = &sv_list[33];
	GvFILE(gv_list[54]) = "\335\367\302";
	gv_list[55] = gv_fetchpv("main::_</usr/lib/perl5/5.8.5/i386-linux-thread-multi/auto/IO/IO.so", TRUE, SVt_PV);
	SvFLAGS(gv_list[55]) = 0x600d;
	GvFLAGS(gv_list[55]) = 0x2;
	GvLINE(gv_list[55]) = 87;
	SvPVX(gv_list[55]) = emptystring;

	SvREFCNT(gv_list[55]) += 2;
	GvREFCNT(gv_list[55]) += 1;
	xpv_list[10].xpv_pv = savepvn("/usr/lib/perl5/5.8.5/i386-linux-thread-multi/auto/IO/IO.so", 58);
	GvSV(gv_list[55]) = &sv_list[34];
	GvFILE(gv_list[55]) = "/usr/lib/perl5/5.8.5/i386-linux-thread-multi/XSLoader.pm";
	gv_list[56] = gv_fetchpv("attributes::bootstrap", TRUE, SVt_PV);
	SvFLAGS(gv_list[56]) = 0x600d;
	GvFLAGS(gv_list[56]) = 0x2;
	GvLINE(gv_list[56]) = 0;
	SvPVX(gv_list[56]) = emptystring;

	SvREFCNT(gv_list[56]) += 2;
	GvREFCNT(gv_list[56]) += 1;
	GvSV(gv_list[56]) = &sv_list[35];
	GvFILE(gv_list[56]) = "hello.p";
	gv_list[57] = gv_fetchpv("main::stdin", TRUE, SVt_PV);
	SvFLAGS(gv_list[57]) = 0x600d;
	GvFLAGS(gv_list[57]) = 0x2;
	GvLINE(gv_list[57]) = 0;
	SvPVX(gv_list[57]) = emptystring;

	SvREFCNT(gv_list[57]) += 2;
	GvREFCNT(gv_list[57]) += 1;
	GvSV(gv_list[57]) = &sv_list[36];
	GvFILE(gv_list[57]) = "hello.p";
	IoIFP((IO*)&sv_list[37])=PerlIO_stdin();
	IoOFP((IO*)&sv_list[37])=PerlIO_stdin();
	SvSTASH((IO*)&sv_list[37]) = hv0;
	GvIOp(gv_list[57]) = (IO*)&sv_list[37];
	gv_list[58] = gv_fetchpv("main::ARGV", TRUE, SVt_PV);
	SvFLAGS(gv_list[58]) = 0x600d;
	GvFLAGS(gv_list[58]) = 0x2;
	GvLINE(gv_list[58]) = 0;
	SvPVX(gv_list[58]) = emptystring;

	SvREFCNT(gv_list[58]) += 2;
	GvREFCNT(gv_list[58]) += 1;
	gv_list[59] = gv_fetchpv("main::INC", TRUE, SVt_PV);
	SvFLAGS(gv_list[59]) = 0x600d;
	GvFLAGS(gv_list[59]) = 0xa;
	GvLINE(gv_list[59]) = 0;
	SvPVX(gv_list[59]) = emptystring;

	SvREFCNT(gv_list[59]) += 7;
	GvREFCNT(gv_list[59]) += 1;
	GvSV(gv_list[59]) = &sv_list[38];
	xpv_list[11].xpv_pv = savepvn("/usr/lib/perl5/5.8.5/i386-linux-thread-multi", 44);
	xpv_list[12].xpv_pv = savepvn("/usr/lib/perl5/5.8.5", 20);
	xpv_list[13].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi", 54);
	xpv_list[14].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi", 54);
	xpv_list[15].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi", 54);
	xpv_list[16].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.2/i386-linux-thread-multi", 54);
	xpv_list[17].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi", 54);
	xpv_list[18].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi", 54);
	xpv_list[19].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.5", 30);
	xpv_list[20].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.4", 30);
	xpv_list[21].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.3", 30);
	xpv_list[22].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.2", 30);
	xpv_list[23].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.1", 30);
	xpv_list[24].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.0", 30);
	xpv_list[25].xpv_pv = savepvn("/usr/lib/perl5/site_perl", 24);
	xpv_list[26].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi", 56);
	xpv_list[27].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi", 56);
	xpv_list[28].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi", 56);
	xpv_list[29].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi", 56);
	xpv_list[30].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi", 56);
	xpv_list[31].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi", 56);
	xpv_list[32].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.5", 32);
	xpv_list[33].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.4", 32);
	xpv_list[34].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.3", 32);
	xpv_list[35].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.2", 32);
	xpv_list[36].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.1", 32);
	xpv_list[37].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.0", 32);
	xpv_list[38].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl", 26);
	xpv_list[39].xpv_pv = savepvn(".", 1);
	xpv_list[40].xpv_pv = savepvn("/usr/lib/perl5/5.8.5/i386-linux-thread-multi", 44);
	xpv_list[41].xpv_pv = savepvn("/usr/lib/perl5/5.8.5", 20);
	xpv_list[42].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.5/i386-linux-thread-multi", 54);
	xpv_list[43].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.4/i386-linux-thread-multi", 54);
	xpv_list[44].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.3/i386-linux-thread-multi", 54);
	xpv_list[45].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.2/i386-linux-thread-multi", 54);
	xpv_list[46].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.1/i386-linux-thread-multi", 54);
	xpv_list[47].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi", 54);
	xpv_list[48].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.5", 30);
	xpv_list[49].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.4", 30);
	xpv_list[50].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.3", 30);
	xpv_list[51].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.2", 30);
	xpv_list[52].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.1", 30);
	xpv_list[53].xpv_pv = savepvn("/usr/lib/perl5/site_perl/5.8.0", 30);
	xpv_list[54].xpv_pv = savepvn("/usr/lib/perl5/site_perl", 24);
	xpv_list[55].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.5/i386-linux-thread-multi", 56);
	xpv_list[56].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.4/i386-linux-thread-multi", 56);
	xpv_list[57].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.3/i386-linux-thread-multi", 56);
	xpv_list[58].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.2/i386-linux-thread-multi", 56);
	xpv_list[59].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.1/i386-linux-thread-multi", 56);
	xpv_list[60].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi", 56);
	xpv_list[61].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.5", 32);
	xpv_list[62].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.4", 32);
	xpv_list[63].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.3", 32);
	xpv_list[64].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.2", 32);
	xpv_list[65].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.1", 32);
	xpv_list[66].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl/5.8.0", 32);
	xpv_list[67].xpv_pv = savepvn("/usr/lib/perl5/vendor_perl", 26);
	xpv_list[68].xpv_pv = savepvn(".", 1);
	{
		SV **svp;
		AV *av = (AV*)&sv_list[39];
		av_extend(av, 57);
		svp = AvARRAY(av);
		*svp++ = (SV*)&sv_list[40];
		*svp++ = (SV*)&sv_list[41];
		*svp++ = (SV*)&sv_list[42];
		*svp++ = (SV*)&sv_list[43];
		*svp++ = (SV*)&sv_list[44];
		*svp++ = (SV*)&sv_list[45];
		*svp++ = (SV*)&sv_list[46];
		*svp++ = (SV*)&sv_list[47];
		*svp++ = (SV*)&sv_list[48];
		*svp++ = (SV*)&sv_list[49];
		*svp++ = (SV*)&sv_list[50];
		*svp++ = (SV*)&sv_list[51];
		*svp++ = (SV*)&sv_list[52];
		*svp++ = (SV*)&sv_list[53];
		*svp++ = (SV*)&sv_list[54];
		*svp++ = (SV*)&sv_list[55];
		*svp++ = (SV*)&sv_list[56];
		*svp++ = (SV*)&sv_list[57];
		*svp++ = (SV*)&sv_list[58];
		*svp++ = (SV*)&sv_list[59];
		*svp++ = (SV*)&sv_list[60];
		*svp++ = (SV*)&sv_list[61];
		*svp++ = (SV*)&sv_list[62];
		*svp++ = (SV*)&sv_list[63];
		*svp++ = (SV*)&sv_list[64];
		*svp++ = (SV*)&sv_list[65];
		*svp++ = (SV*)&sv_list[66];
		*svp++ = (SV*)&sv_list[67];
		*svp++ = (SV*)&sv_list[68];
		*svp++ = (SV*)&sv_list[69];
		*svp++ = (SV*)&sv_list[70];
		*svp++ = (SV*)&sv_list[71];
		*svp++ = (SV*)&sv_list[72];
		*svp++ = (SV*)&sv_list[73];
		*svp++ = (SV*)&sv_list[74];
		*svp++ = (SV*)&sv_list[75];
		*svp++ = (SV*)&sv_list[76];
		*svp++ = (SV*)&sv_list[77];
		*svp++ = (SV*)&sv_list[78];
		*svp++ = (SV*)&sv_list[79];
		*svp++ = (SV*)&sv_list[80];
		*svp++ = (SV*)&sv_list[81];
		*svp++ = (SV*)&sv_list[82];
		*svp++ = (SV*)&sv_list[83];
		*svp++ = (SV*)&sv_list[84];
		*svp++ = (SV*)&sv_list[85];
		*svp++ = (SV*)&sv_list[86];
		*svp++ = (SV*)&sv_list[87];
		*svp++ = (SV*)&sv_list[88];
		*svp++ = (SV*)&sv_list[89];
		*svp++ = (SV*)&sv_list[90];
		*svp++ = (SV*)&sv_list[91];
		*svp++ = (SV*)&sv_list[92];
		*svp++ = (SV*)&sv_list[93];
		*svp++ = (SV*)&sv_list[94];
		*svp++ = (SV*)&sv_list[95];
		*svp++ = (SV*)&sv_list[96];
		*svp++ = (SV*)&sv_list[97];
	

		AvFILLp(av) = 57;
	}
	GvAV(gv_list[59]) = (AV*)&sv_list[39];
	GvHV(gv_list[59]) = (HV*)&sv_list[98];
	GvFILE(gv_list[59]) = "";
	gv_list[60] = gv_fetchpv("main::ENV", TRUE, SVt_PV);
	SvFLAGS(gv_list[60]) = 0x600d;
	GvFLAGS(gv_list[60]) = 0xa;
	GvLINE(gv_list[60]) = 0;
	SvPVX(gv_list[60]) = emptystring;

	SvREFCNT(gv_list[60]) += 5;
	GvREFCNT(gv_list[60]) += 1;
	gv_list[61] = gv_fetchpv("main::_<perlio.c", TRUE, SVt_PV);
	SvFLAGS(gv_list[61]) = 0x600d;
	GvFLAGS(gv_list[61]) = 0x2;
	GvLINE(gv_list[61]) = 0;
	SvPVX(gv_list[61]) = emptystring;

	SvREFCNT(gv_list[61]) += 2;
	GvREFCNT(gv_list[61]) += 1;
	xpv_list[69].xpv_pv = savepvn("perlio.c", 8);
	GvSV(gv_list[61]) = &sv_list[99];
	GvFILE(gv_list[61]) = "hello.p";
	gv_list[62] = gv_fetchpv("main:::", TRUE, SVt_PV);
	SvFLAGS(gv_list[62]) = 0x600d;
	GvFLAGS(gv_list[62]) = 0xa;
	GvLINE(gv_list[62]) = 546;
	SvPVX(gv_list[62]) = emptystring;

	SvREFCNT(gv_list[62]) += 4;
	GvREFCNT(gv_list[62]) += 1;
	gv_list[63] = gv_fetchpv("PerlIO::get_layers", TRUE, SVt_PV);
	SvFLAGS(gv_list[63]) = 0x600d;
	GvFLAGS(gv_list[63]) = 0x2;
	GvLINE(gv_list[63]) = 0;
	SvPVX(gv_list[63]) = emptystring;

	SvREFCNT(gv_list[63]) += 2;
	GvREFCNT(gv_list[63]) += 1;
	GvSV(gv_list[63]) = &sv_list[100];
	GvCV(gv_list[63]) = (CV*)((perl_get_cv("PerlIO::get_layers",TRUE)));
	GvFILE(gv_list[63]) = "hello.p";
	gv_list[64] = gv_fetchpv("PerlIO::Layer::NoWarnings", TRUE, SVt_PV);
	SvFLAGS(gv_list[64]) = 0x600d;
	GvFLAGS(gv_list[64]) = 0x2;
	GvLINE(gv_list[64]) = 0;
	SvPVX(gv_list[64]) = emptystring;

	SvREFCNT(gv_list[64]) += 2;
	GvREFCNT(gv_list[64]) += 1;
	GvSV(gv_list[64]) = &sv_list[101];
	GvCV(gv_list[64]) = (CV*)((perl_get_cv("PerlIO::Layer::NoWarnings",TRUE)));
	GvFILE(gv_list[64]) = "hello.p";
	gv_list[65] = gv_fetchpv("PerlIO::Layer::find", TRUE, SVt_PV);
	SvFLAGS(gv_list[65]) = 0x600d;
	GvFLAGS(gv_list[65]) = 0x2;
	GvLINE(gv_list[65]) = 0;
	SvPVX(gv_list[65]) = emptystring;

	SvREFCNT(gv_list[65]) += 2;
	GvREFCNT(gv_list[65]) += 1;
	GvSV(gv_list[65]) = &sv_list[102];
	GvCV(gv_list[65]) = (CV*)((perl_get_cv("PerlIO::Layer::find",TRUE)));
	GvFILE(gv_list[65]) = "hello.p";
	gv_list[66] = gv_fetchpv("main::0", TRUE, SVt_PV);
	SvFLAGS(gv_list[66]) = 0x600d;
	GvFLAGS(gv_list[66]) = 0xa;
	GvLINE(gv_list[66]) = 0;
	SvPVX(gv_list[66]) = emptystring;

	SvREFCNT(gv_list[66]) += 5;
	GvREFCNT(gv_list[66]) += 1;
	gv_list[67] = gv_fetchpv("main::.", TRUE, SVt_PV);
	SvFLAGS(gv_list[67]) = 0x600d;
	GvFLAGS(gv_list[67]) = 0xa;
	GvLINE(gv_list[67]) = 496;
	SvPVX(gv_list[67]) = emptystring;

	SvREFCNT(gv_list[67]) += 5;
	GvREFCNT(gv_list[67]) += 1;
	gv_list[68] = gv_fetchpv("main::\b", TRUE, SVt_PV);
	SvFLAGS(gv_list[68]) = 0x600d;
	GvFLAGS(gv_list[68]) = 0xa;
	GvLINE(gv_list[68]) = 0;
	SvPVX(gv_list[68]) = emptystring;

	SvREFCNT(gv_list[68]) += 5;
	GvREFCNT(gv_list[68]) += 1;
	gv_list[69] = gv_fetchpv("main::@", TRUE, SVt_PV);
	SvFLAGS(gv_list[69]) = 0x600d;
	GvFLAGS(gv_list[69]) = 0xa;
	GvLINE(gv_list[69]) = 0;
	SvPVX(gv_list[69]) = emptystring;

	SvREFCNT(gv_list[69]) += 13;
	GvREFCNT(gv_list[69]) += 1;
	gv_list[70] = gv_fetchpv("main::_</usr/lib/perl5/5.8.5/base.pm", TRUE, SVt_PV);
	SvFLAGS(gv_list[70]) = 0x600d;
	GvFLAGS(gv_list[70]) = 0x2;
	GvLINE(gv_list[70]) = 8;
	SvPVX(gv_list[70]) = emptystring;

	SvREFCNT(gv_list[70]) += 2;
	GvREFCNT(gv_list[70]) += 1;
	xpv_list[70].xpv_pv = savepvn("/usr/lib/perl5/5.8.5/base.pm", 28);
	GvSV(gv_list[70]) = &sv_list[103];
	GvFILE(gv_list[70]) = "\270/\r\b";
	gv_list[71] = gv_fetchpv("main::STDOUT", TRUE, SVt_PV);
	SvFLAGS(gv_list[71]) = 0x630d;
	GvFLAGS(gv_list[71]) = 0xa;
	GvLINE(gv_list[71]) = 0;
	SvPVX(gv_list[71]) = emptystring;

	SvREFCNT(gv_list[71]) += 13;
	GvREFCNT(gv_list[71]) += 1;
	gv_list[72] = gv_fetchpv("main::_</usr/lib/perl5/5.8.5/i386-linux-thread-multi/B/C.pm", TRUE, SVt_PV);
	SvFLAGS(gv_list[72]) = 0x600d;
	GvFLAGS(gv_list[72]) = 0x2;
	GvLINE(gv_list[72]) = 1096;
	SvPVX(gv_list[72]) = emptystring;

	SvREFCNT(gv_list[72]) += 2;
	GvREFCNT(gv_list[72]) += 1;
	xpv_list[71].xpv_pv = savepvn("/usr/lib/perl5/5.8.5/i386-linux-thread-multi/B/C.pm", 51);
	GvSV(gv_list[72]) = &sv_list[104];
	GvFILE(gv_list[72]) = "";
	gv_list[73] = gv_fetchpv("main::_</usr/lib/perl5/5.8.5/i386-linux-thread-multi/B.pm", TRUE, SVt_PV);
	SvFLAGS(gv_list[73]) = 0x600d;
	GvFLAGS(gv_list[73]) = 0x2;
	GvLINE(gv_list[73]) = 87;
	SvPVX(gv_list[73]) = emptystring;

	SvREFCNT(gv_list[73]) += 2;
	GvREFCNT(gv_list[73]) += 1;
	xpv_list[72].xpv_pv = savepvn("/usr/lib/perl5/5.8.5/i386-linux-thread-multi/B.pm", 49);
	GvSV(gv_list[73]) = &sv_list[105];
	GvFILE(gv_list[73]) = "\210\327\a\b\b";
	gv_list[74] = gv_fetchpv("main::]", TRUE, SVt_PV);
	SvFLAGS(gv_list[74]) = 0x600d;
	GvFLAGS(gv_list[74]) = 0xa;
	GvLINE(gv_list[74]) = 41;
	SvPVX(gv_list[74]) = emptystring;

	SvREFCNT(gv_list[74]) += 2;
	GvREFCNT(gv_list[74]) += 1;
	gv_list[75] = gv_fetchpv("main::\027", TRUE, SVt_PV);
	SvFLAGS(gv_list[75]) = 0x600d;
	GvFLAGS(gv_list[75]) = 0xa;
	GvLINE(gv_list[75]) = 227;
	SvPVX(gv_list[75]) = emptystring;

	SvREFCNT(gv_list[75]) += 4;
	GvREFCNT(gv_list[75]) += 1;
	gv_list[76] = gv_fetchpv("main::STDERR", TRUE, SVt_PV);
	SvFLAGS(gv_list[76]) = 0x630d;
	GvFLAGS(gv_list[76]) = 0xa;
	GvLINE(gv_list[76]) = 0;
	SvPVX(gv_list[76]) = emptystring;

	SvREFCNT(gv_list[76]) += 4;
	GvREFCNT(gv_list[76]) += 1;
	gv_list[77] = gv_fetchpv("main::_</usr/lib/perl5/5.8.5/i386-linux-thread-multi/auto/B/B.so", TRUE, SVt_PV);
	SvFLAGS(gv_list[77]) = 0x600d;
	GvFLAGS(gv_list[77]) = 0x2;
	GvLINE(gv_list[77]) = 87;
	SvPVX(gv_list[77]) = emptystring;

	SvREFCNT(gv_list[77]) += 2;
	GvREFCNT(gv_list[77]) += 1;
	xpv_list[73].xpv_pv = savepvn("/usr/lib/perl5/5.8.5/i386-linux-thread-multi/auto/B/B.so", 56);
	GvSV(gv_list[77]) = &sv_list[106];
	GvFILE(gv_list[77]) = "/usr/lib/perl5/5.8.5/i386-linux-thread-multi/XSLoader.pm";
	gv_list[78] = gv_fetchpv("main::_</usr/lib/perl5/5.8.5/i386-linux-thread-multi/auto/Fcntl/Fcntl.so", TRUE, SVt_PV);
	SvFLAGS(gv_list[78]) = 0x600d;
	GvFLAGS(gv_list[78]) = 0x2;
	GvLINE(gv_list[78]) = 87;
	SvPVX(gv_list[78]) = emptystring;

	SvREFCNT(gv_list[78]) += 2;
	GvREFCNT(gv_list[78]) += 1;
	xpv_list[74].xpv_pv = savepvn("/usr/lib/perl5/5.8.5/i386-linux-thread-multi/auto/Fcntl/Fcntl.so", 64);
	GvSV(gv_list[78]) = &sv_list[107];
	GvFILE(gv_list[78]) = "/usr/lib/perl5/5.8.5/i386-linux-thread-multi/XSLoader.pm";
	    PL_dowarn = ( 0 ) ? G_WARN_ON : G_WARN_OFF;
	PL_main_root = (OP*)&listop_list[0];
	PL_main_start = &op_list[0];
	PL_initav = (AV *) Nullsv;
	PL_endav = (AV*) Nullsv;
	xpv_list[75].xpv_pv = savepvn("Hello World\n", 12);
	{
		SV **svp;
		AV *av = (AV*)&sv_list[109];
		av_extend(av, 2);
		svp = AvARRAY(av);
		*svp++ = (SV*)&PL_sv_undef;
		*svp++ = (SV*)&sv_list[110];
		*svp++ = (SV*)&sv_list[111];
	

		AvFILLp(av) = 2;
	}
	PL_curpad = AvARRAY((AV*)&sv_list[109]);
	GvHV(PL_incgv) = (HV*)&sv_list[98];
	GvAV(PL_incgv) = (AV*)&sv_list[39];
	av_store(CvPADLIST(PL_main_cv),0,SvREFCNT_inc((AV*)&sv_list[108]));
	av_store(CvPADLIST(PL_main_cv),1,SvREFCNT_inc((AV*)&sv_list[109]));
	PL_amagic_generation= 0;
	return 0;
}
예제 #9
0
STATIC void
S_mro_gather_and_rename(pTHX_ HV * const stashes, HV * const seen_stashes,
                        HV *stash, HV *oldstash, SV *namesv)
{
    XPVHV* xhv;
    HE *entry;
    I32 riter = -1;
    I32 items = 0;
    const bool stash_had_name = stash && HvENAME(stash);
    bool fetched_isarev = FALSE;
    HV *seen = NULL;
    HV *isarev = NULL;
    SV **svp = NULL;

    PERL_ARGS_ASSERT_MRO_GATHER_AND_RENAME;

    /* We use the seen_stashes hash to keep track of which packages have
       been encountered so far. This must be separate from the main list of
       stashes, as we need to distinguish between stashes being assigned
       and stashes being replaced/deleted. (A nested stash can be on both
       sides of an assignment. We cannot simply skip iterating through a
       stash on the right if we have seen it on the left, as it will not
       get its ename assigned to it.)

       To avoid allocating extra SVs, instead of a bitfield we can make
       bizarre use of immortals:

        &PL_sv_undef:  seen on the left  (oldstash)
        &PL_sv_no   :  seen on the right (stash)
        &PL_sv_yes  :  seen on both sides

     */

    if(oldstash) {
        /* Add to the big list. */
        struct mro_meta * meta;
        HE * const entry
            = (HE *)
              hv_common(
                  seen_stashes, NULL, (const char *)&oldstash, sizeof(HV *), 0,
                  HV_FETCH_LVALUE|HV_FETCH_EMPTY_HE, NULL, 0
              );
        if(HeVAL(entry) == &PL_sv_undef || HeVAL(entry) == &PL_sv_yes) {
            oldstash = NULL;
            goto check_stash;
        }
        HeVAL(entry)
            = HeVAL(entry) == &PL_sv_no ? &PL_sv_yes : &PL_sv_undef;
        meta = HvMROMETA(oldstash);
        (void)
        hv_store(
            stashes, (const char *)&oldstash, sizeof(HV *),
            meta->isa
            ? SvREFCNT_inc_simple_NN((SV *)meta->isa)
            : &PL_sv_yes,
            0
        );
        CLEAR_LINEAR(meta);

        /* Update the effective name. */
        if(HvENAME_get(oldstash)) {
            const HEK * const enamehek = HvENAME_HEK(oldstash);
            if(SvTYPE(namesv) == SVt_PVAV) {
                items = AvFILLp((AV *)namesv) + 1;
                svp = AvARRAY((AV *)namesv);
            }
            else {
                items = 1;
                svp = &namesv;
            }
            while (items--) {
                const U32 name_utf8 = SvUTF8(*svp);
                STRLEN len;
                const char *name = SvPVx_const(*svp, len);
                if(PL_stashcache) {
                    DEBUG_o(Perl_deb(aTHX_ "mro_gather_and_rename clearing PL_stashcache for '%"SVf"'\n",
                                     SVfARG(*svp)));
                    (void)hv_delete(PL_stashcache, name, name_utf8 ? -(I32)len : (I32)len, G_DISCARD);
                }
                ++svp;
                hv_ename_delete(oldstash, name, len, name_utf8);

                if (!fetched_isarev) {
                    /* If the name deletion caused a name change, then we
                     * are not going to call mro_isa_changed_in with this
                     * name (and not at all if it has become anonymous) so
                     * we need to delete old isarev entries here, both
                     * those in the superclasses and this class's own list
                     * of subclasses. We simply delete the latter from
                     * PL_isarev, since we still need it. hv_delete morti-
                     * fies it for us, so sv_2mortal is not necessary. */
                    if(HvENAME_HEK(oldstash) != enamehek) {
                        if(meta->isa && HvARRAY(meta->isa))
                            mro_clean_isarev(meta->isa, name, len, 0, 0,
                                             name_utf8 ? HVhek_UTF8 : 0);
                        isarev = (HV *)hv_delete(PL_isarev, name,
                                                 name_utf8 ? -(I32)len : (I32)len, 0);
                        fetched_isarev=TRUE;
                    }
                }
            }
        }
    }
check_stash:
    if(stash) {
        if(SvTYPE(namesv) == SVt_PVAV) {
            items = AvFILLp((AV *)namesv) + 1;
            svp = AvARRAY((AV *)namesv);
        }
        else {
            items = 1;
            svp = &namesv;
        }
        while (items--) {
            const U32 name_utf8 = SvUTF8(*svp);
            STRLEN len;
            const char *name = SvPVx_const(*svp++, len);
            hv_ename_add(stash, name, len, name_utf8);
        }

        /* Add it to the big list if it needs
        * mro_isa_changed_in called on it. That happens if it was
        * detached from the symbol table (so it had no HvENAME) before
        * being assigned to the spot named by the 'name' variable, because
        * its cached isa linearisation is now stale (the effective name
        * having changed), and subclasses will then use that cache when
        * mro_package_moved calls mro_isa_changed_in. (See
        * [perl #77358].)
        *
        * If it did have a name, then its previous name is still
        * used in isa caches, and there is no need for
        * mro_package_moved to call mro_isa_changed_in.
        */

        entry
            = (HE *)
              hv_common(
                  seen_stashes, NULL, (const char *)&stash, sizeof(HV *), 0,
                  HV_FETCH_LVALUE|HV_FETCH_EMPTY_HE, NULL, 0
              );
        if(HeVAL(entry) == &PL_sv_yes || HeVAL(entry) == &PL_sv_no)
            stash = NULL;
        else {
            HeVAL(entry)
                = HeVAL(entry) == &PL_sv_undef ? &PL_sv_yes : &PL_sv_no;
            if(!stash_had_name)
            {
                struct mro_meta * const meta = HvMROMETA(stash);
                (void)
                hv_store(
                    stashes, (const char *)&stash, sizeof(HV *),
                    meta->isa
                    ? SvREFCNT_inc_simple_NN((SV *)meta->isa)
                    : &PL_sv_yes,
                    0
                );
                CLEAR_LINEAR(meta);
            }
        }
    }

    if(!stash && !oldstash)
        /* Both stashes have been encountered already. */
        return;

    /* Add all the subclasses to the big list. */
    if(!fetched_isarev) {
        /* If oldstash is not null, then we can use its HvENAME to look up
           the isarev hash, since all its subclasses will be listed there.
           It will always have an HvENAME. It the HvENAME was removed
           above, then fetch_isarev will be true, and this code will not be
           reached.

           If oldstash is null, then this is an empty spot with no stash in
           it, so subclasses could be listed in isarev hashes belonging to
           any of the names, so we have to check all of them.
         */
        assert(!oldstash || HvENAME(oldstash));
        if (oldstash) {
            /* Extra variable to avoid a compiler warning */
            const HEK * const hvename = HvENAME_HEK(oldstash);
            fetched_isarev = TRUE;
            svp = hv_fetchhek(PL_isarev, hvename, 0);
            if (svp) isarev = MUTABLE_HV(*svp);
        }
        else if(SvTYPE(namesv) == SVt_PVAV) {
            items = AvFILLp((AV *)namesv) + 1;
            svp = AvARRAY((AV *)namesv);
        }
        else {
            items = 1;
            svp = &namesv;
        }
    }
    if(
        isarev || !fetched_isarev
    ) {
        while (fetched_isarev || items--) {
            HE *iter;

            if (!fetched_isarev) {
                HE * const he = hv_fetch_ent(PL_isarev, *svp++, 0, 0);
                if (!he || !(isarev = MUTABLE_HV(HeVAL(he)))) continue;
            }

            hv_iterinit(isarev);
            while((iter = hv_iternext(isarev))) {
                HV* revstash = gv_stashsv(hv_iterkeysv(iter), 0);
                struct mro_meta * meta;

                if(!revstash) continue;
                meta = HvMROMETA(revstash);
                (void)
                hv_store(
                    stashes, (const char *)&revstash, sizeof(HV *),
                    meta->isa
                    ? SvREFCNT_inc_simple_NN((SV *)meta->isa)
                    : &PL_sv_yes,
                    0
                );
                CLEAR_LINEAR(meta);
            }

            if (fetched_isarev) break;
        }
    }

    /* This is partly based on code in hv_iternext_flags. We are not call-
       ing that here, as we want to avoid resetting the hash iterator. */

    /* Skip the entire loop if the hash is empty.   */
    if(oldstash && HvUSEDKEYS(oldstash)) {
        xhv = (XPVHV*)SvANY(oldstash);
        seen = (HV *) sv_2mortal((SV *)newHV());

        /* Iterate through entries in the oldstash, adding them to the
           list, meanwhile doing the equivalent of $seen{$key} = 1.
         */

        while (++riter <= (I32)xhv->xhv_max) {
            entry = (HvARRAY(oldstash))[riter];

            /* Iterate through the entries in this list */
            for(; entry; entry = HeNEXT(entry)) {
                const char* key;
                I32 len;

                /* If this entry is not a glob, ignore it.
                   Try the next.  */
                if (!isGV(HeVAL(entry))) continue;

                key = hv_iterkey(entry, &len);
                if ((len > 1 && key[len-2] == ':' && key[len-1] == ':')
                        || (len == 1 && key[0] == ':')) {
                    HV * const oldsubstash = GvHV(HeVAL(entry));
                    SV ** const stashentry
                        = stash ? hv_fetch(stash, key, HeUTF8(entry) ? -(I32)len : (I32)len, 0) : NULL;
                    HV *substash = NULL;

                    /* Avoid main::main::main::... */
                    if(oldsubstash == oldstash) continue;

                    if(
                        (
                            stashentry && *stashentry && isGV(*stashentry)
                            && (substash = GvHV(*stashentry))
                        )
                        || (oldsubstash && HvENAME_get(oldsubstash))
                    )
                    {
                        /* Add :: and the key (minus the trailing ::)
                           to each name. */
                        SV *subname;
                        if(SvTYPE(namesv) == SVt_PVAV) {
                            SV *aname;
                            items = AvFILLp((AV *)namesv) + 1;
                            svp = AvARRAY((AV *)namesv);
                            subname = sv_2mortal((SV *)newAV());
                            while (items--) {
                                aname = newSVsv(*svp++);
                                if (len == 1)
                                    sv_catpvs(aname, ":");
                                else {
                                    sv_catpvs(aname, "::");
                                    sv_catpvn_flags(
                                        aname, key, len-2,
                                        HeUTF8(entry)
                                        ? SV_CATUTF8 : SV_CATBYTES
                                    );
                                }
                                av_push((AV *)subname, aname);
                            }
                        }
                        else {
                            subname = sv_2mortal(newSVsv(namesv));
                            if (len == 1) sv_catpvs(subname, ":");
                            else {
                                sv_catpvs(subname, "::");
                                sv_catpvn_flags(
                                    subname, key, len-2,
                                    HeUTF8(entry) ? SV_CATUTF8 : SV_CATBYTES
                                );
                            }
                        }
                        mro_gather_and_rename(
                            stashes, seen_stashes,
                            substash, oldsubstash, subname
                        );
                    }

                    (void)hv_store(seen, key, HeUTF8(entry) ? -(I32)len : (I32)len, &PL_sv_yes, 0);
                }
            }
        }
    }

    /* Skip the entire loop if the hash is empty.   */
    if (stash && HvUSEDKEYS(stash)) {
        xhv = (XPVHV*)SvANY(stash);
        riter = -1;

        /* Iterate through the new stash, skipping $seen{$key} items,
           calling mro_gather_and_rename(stashes,seen,entry,NULL, ...). */
        while (++riter <= (I32)xhv->xhv_max) {
            entry = (HvARRAY(stash))[riter];

            /* Iterate through the entries in this list */
            for(; entry; entry = HeNEXT(entry)) {
                const char* key;
                I32 len;

                /* If this entry is not a glob, ignore it.
                   Try the next.  */
                if (!isGV(HeVAL(entry))) continue;

                key = hv_iterkey(entry, &len);
                if ((len > 1 && key[len-2] == ':' && key[len-1] == ':')
                        || (len == 1 && key[0] == ':')) {
                    HV *substash;

                    /* If this entry was seen when we iterated through the
                       oldstash, skip it. */
                    if(seen && hv_exists(seen, key, HeUTF8(entry) ? -(I32)len : (I32)len)) continue;

                    /* We get here only if this stash has no corresponding
                       entry in the stash being replaced. */

                    substash = GvHV(HeVAL(entry));
                    if(substash) {
                        SV *subname;

                        /* Avoid checking main::main::main::... */
                        if(substash == stash) continue;

                        /* Add :: and the key (minus the trailing ::)
                           to each name. */
                        if(SvTYPE(namesv) == SVt_PVAV) {
                            SV *aname;
                            items = AvFILLp((AV *)namesv) + 1;
                            svp = AvARRAY((AV *)namesv);
                            subname = sv_2mortal((SV *)newAV());
                            while (items--) {
                                aname = newSVsv(*svp++);
                                if (len == 1)
                                    sv_catpvs(aname, ":");
                                else {
                                    sv_catpvs(aname, "::");
                                    sv_catpvn_flags(
                                        aname, key, len-2,
                                        HeUTF8(entry)
                                        ? SV_CATUTF8 : SV_CATBYTES
                                    );
                                }
                                av_push((AV *)subname, aname);
                            }
                        }
                        else {
                            subname = sv_2mortal(newSVsv(namesv));
                            if (len == 1) sv_catpvs(subname, ":");
                            else {
                                sv_catpvs(subname, "::");
                                sv_catpvn_flags(
                                    subname, key, len-2,
                                    HeUTF8(entry) ? SV_CATUTF8 : SV_CATBYTES
                                );
                            }
                        }
                        mro_gather_and_rename(
                            stashes, seen_stashes,
                            substash, NULL, subname
                        );
                    }
                }
            }
        }
    }
}
예제 #10
0
void
Perl_taint_env(pTHX)
{
    SV** svp;
    MAGIC* mg;
    const char* const *e;
    static const char* const misc_env[] = {
        "IFS",		/* most shells' inter-field separators */
        "CDPATH",	/* ksh dain bramage #1 */
        "ENV",		/* ksh dain bramage #2 */
        "BASH_ENV",	/* bash dain bramage -- I guess it's contagious */
#ifdef WIN32
        "PERL5SHELL",	/* used for system() on Windows */
#endif
        NULL
    };

    /* Don't bother if there's no *ENV glob */
    if (!PL_envgv)
        return;
    /* If there's no %ENV hash or if it's not magical, croak, because
     * it probably doesn't reflect the actual environment */
    if (!GvHV(PL_envgv) || !(SvRMAGICAL(GvHV(PL_envgv))
            && mg_find((const SV *)GvHV(PL_envgv), PERL_MAGIC_env))) {
        const bool was_tainted = TAINT_get;
        const char * const name = GvENAME(PL_envgv);
        TAINT;
        if (strEQ(name,"ENV"))
            /* hash alias */
            taint_proper("%%ENV is aliased to %s%s", "another variable");
        else
            /* glob alias: report it in the error message */
            taint_proper("%%ENV is aliased to %%%s%s", name);
        /* this statement is reached under -t or -U */
        TAINT_set(was_tainted);
#ifdef NO_TAINT_SUPPORT
        PERL_UNUSED_VAR(was_tainted);
#endif
    }

#ifdef VMS
    {
    int i = 0;
    char name[10 + TYPE_DIGITS(int)] = "DCL$PATH";
    STRLEN len = 8; /* strlen(name)  */

    while (1) {
        if (i)
            len = my_sprintf(name,"DCL$PATH;%d", i);
        svp = hv_fetch(GvHVn(PL_envgv), name, len, FALSE);
        if (!svp || *svp == &PL_sv_undef)
            break;
        if (SvTAINTED(*svp)) {
            TAINT;
            taint_proper("Insecure %s%s", "$ENV{DCL$PATH}");
        }
        if ((mg = mg_find(*svp, PERL_MAGIC_envelem)) && MgTAINTEDDIR(mg)) {
            TAINT;
            taint_proper("Insecure directory in %s%s", "$ENV{DCL$PATH}");
        }
        i++;
    }
  }
#endif /* VMS */

    svp = hv_fetchs(GvHVn(PL_envgv),"PATH",FALSE);
    if (svp && *svp) {
        if (SvTAINTED(*svp)) {
            TAINT;
            taint_proper("Insecure %s%s", "$ENV{PATH}");
        }
        if ((mg = mg_find(*svp, PERL_MAGIC_envelem)) && MgTAINTEDDIR(mg)) {
            TAINT;
            taint_proper("Insecure directory in %s%s", "$ENV{PATH}");
        }
    }

#ifndef VMS
    /* tainted $TERM is okay if it contains no metachars */
    svp = hv_fetchs(GvHVn(PL_envgv),"TERM",FALSE);
    if (svp && *svp && SvTAINTED(*svp)) {
        STRLEN len;
        const bool was_tainted = TAINT_get;
        const char *t = SvPV_const(*svp, len);
        const char * const e = t + len;

        TAINT_set(was_tainted);
#ifdef NO_TAINT_SUPPORT
        PERL_UNUSED_VAR(was_tainted);
#endif
        if (t < e && isWORDCHAR(*t))
            t++;
        while (t < e && (isWORDCHAR(*t) || strchr("-_.+", *t)))
            t++;
        if (t < e) {
            TAINT;
            taint_proper("Insecure $ENV{%s}%s", "TERM");
        }
    }
#endif /* !VMS */

    for (e = misc_env; *e; e++) {
        SV * const * const svp = hv_fetch(GvHVn(PL_envgv), *e, strlen(*e), FALSE);
        if (svp && *svp != &PL_sv_undef && SvTAINTED(*svp)) {
            TAINT;
            taint_proper("Insecure $ENV{%s}%s", *e);
        }
    }
}
예제 #11
0
STATIC SV *
S_isa_lookup(pTHX_ HV *stash, const char *name, int len, int level)
{
    AV* av;
    GV* gv;
    GV** gvp;
    HV* hv = Nullhv;
    SV* subgen = Nullsv;

    if (!stash)
	return &PL_sv_undef;

    if (strEQ(HvNAME(stash), name))
	return &PL_sv_yes;

    if (level > 100)
	Perl_croak(aTHX_ "Recursive inheritance detected in package '%s'",
		   HvNAME(stash));

    gvp = (GV**)hv_fetch(stash, "::ISA::CACHE::", 14, FALSE);

    if (gvp && (gv = *gvp) != (GV*)&PL_sv_undef && (subgen = GvSV(gv))
	&& (hv = GvHV(gv)))
    {
	if (SvIV(subgen) == PL_sub_generation) {
	    SV* sv;
	    SV** svp = (SV**)hv_fetch(hv, name, len, FALSE);
	    if (svp && (sv = *svp) != (SV*)&PL_sv_undef) {
	        DEBUG_o( Perl_deb(aTHX_ "Using cached ISA %s for package %s\n",
				  name, HvNAME(stash)) );
		return sv;
	    }
	}
	else {
	    DEBUG_o( Perl_deb(aTHX_ "ISA Cache in package %s is stale\n",
			      HvNAME(stash)) );
	    hv_clear(hv);
	    sv_setiv(subgen, PL_sub_generation);
	}
    }

    gvp = (GV**)hv_fetch(stash,"ISA",3,FALSE);

    if (gvp && (gv = *gvp) != (GV*)&PL_sv_undef && (av = GvAV(gv))) {
	if (!hv || !subgen) {
	    gvp = (GV**)hv_fetch(stash, "::ISA::CACHE::", 14, TRUE);

	    gv = *gvp;

	    if (SvTYPE(gv) != SVt_PVGV)
		gv_init(gv, stash, "::ISA::CACHE::", 14, TRUE);

	    if (!hv)
		hv = GvHVn(gv);
	    if (!subgen) {
		subgen = newSViv(PL_sub_generation);
		GvSV(gv) = subgen;
	    }
	}
	if (hv) {
	    SV** svp = AvARRAY(av);
	    /* NOTE: No support for tied ISA */
	    I32 items = AvFILLp(av) + 1;
	    while (items--) {
		SV* sv = *svp++;
		HV* basestash = gv_stashsv(sv, FALSE);
		if (!basestash) {
		    if (ckWARN(WARN_MISC))
			Perl_warner(aTHX_ WARN_SYNTAX,
		             "Can't locate package %s for @%s::ISA",
			    SvPVX(sv), HvNAME(stash));
		    continue;
		}
		if (&PL_sv_yes == isa_lookup(basestash, name, len, level + 1)) {
		    (void)hv_store(hv,name,len,&PL_sv_yes,0);
		    return &PL_sv_yes;
		}
	    }
	    (void)hv_store(hv,name,len,&PL_sv_no,0);
	}
    }

    return boolSV(strEQ(name, "UNIVERSAL"));
}
예제 #12
0
USER_OBJECT_ 
fromPerl(SV *val, unsigned int depth)
{
 USER_OBJECT_ ans = NULL_USER_OBJECT;
 USER_OBJECT_ classes;
 svtype type = SvTYPE(val);
 svtype elementType = SVt_NULL;
 svtype refType;
 SV *refVal = NULL;
 dTHX;


 if(type == SVt_PVGV) {
    if(GvHV(val)) 
       ans = fromPerlHV(GvHV(val), depth - 1);
    else if(GvAV(val))
       ans = fromPerlAV(GvAV(val), NULL, depth - 1);
    else if(GvCV(val)) 
       ans = fromPerl((SV *) GvCV(val), 0);
    else if(GvSV(val)) 
       ans = fromPerl(GvSV(val), depth - 1);
    else if(GvIOp(val)) {
          /* XXX */
    } else {
      PROBLEM "Don't understand particular type of PVGV at this point"
      ERROR;
    }
    
    return(ans);
 } else if (type == SVt_PVMG && !sv_isobject(val)) {
	 /* If it is magic and not an object, then treat it as a scalar and
            get it back to R as a value, not a reference.
            Would ideally like to respect the convert option. But
            we can get ourselves into an infinite loop. Needs more investigation.
          */

    return(GetRScalar(val));
 }

 if(val == NULL || val == &sv_undef || (!SvOK(val) && !SvROK(val) && type != SVt_PVCV) /* || type == SVt_NULL */) {

#ifdef R_PERL_DEBUG
     fprintf(stderr, "Null result: %p (%d)  (undef = %p) (type is %s)  SvOK=%d, SvROK=%d\n", 
                       val, type, &sv_undef, type == SVt_NULL ? "null" : "not null", 
                       SvOK(val), SvROK(val)); fflush(stderr);
#endif
    return(NULL_USER_OBJECT);
 }

 if(SvROK(val)) { /* && sv_isobject(val)) { */
     if(sv_isa(val, "RReferences")) {
	 return(RPerl_getProxyValue(val));
     } else {
	 ans = userLevelConversionFromPerl(val, depth);
	 if(ans != NULL)
	     return(ans);
#ifdef R_PERL_DEBUG
	 fprintf(stderr, "Didn't get a user-leve conversion. Continuining with regular conversion\n");
#endif
     }
 }

 classes = computeRSPerlClassVector(val, &elementType, depth);
 if(!depth || (classes && GET_LENGTH(classes))) {
     /* We protect classes in the subroutines. */
   PROTECT(classes);
   ans = makeForeignPerlReference(val, classes, &exportReferenceTable);
   UNPROTECT(1);
   return(ans);
 }

#ifdef R_PERL_DEBUG
fprintf(stderr, "[Converting] element type %d %d %d\n", (int) elementType, (int) SvTYPE(val), (int) (SvTYPE(val) == SVt_RV));
#endif

/*
  If it is a reference, then check whether it is an array or hash.
 */

 if(SvROK(val)) {
     refVal = SvRV(val);
     refType = SvTYPE(refVal);
 } else {
     refVal = val;
     refType = type;
 }


#ifdef R_PERL_DEBUG
 fprintf(stderr, "[fromPerl] refType = %d\n", refType);
#endif

 if(refType == SVt_PVAV ||  refType == SVt_PVHV) {
     if(isHomogeneous(refVal, &elementType)) {
       return( (refType == SVt_PVAV) ? 
	       fromHomogeneousArray(refVal, elementType) :
	       fromHomogeneousTable(refVal, elementType));
     } else {
       return( (refType == SVt_PVAV) ? fromPerlAV((AV*)refVal, NULL, depth) : fromPerlHV((HV*)refVal, depth));
     }
 } else if(refType == SVt_PVCV) {
     return(createPerlReference(refVal));
 }

#ifdef R_PERL_DEBUG
 fprintf(stderr, "[fromPerl] continuing again as refType (%d) was not an array or table.\n", refType);
#endif


 ans = GetRScalar(val);

 return(ans);
}