SvTYPE(rv));
(int)SvTYPE(rv));
request_rec *modperl_xs_sv2request_rec(pTHX_ SV *in, char *classname, CV *cv){    SV *sv = Nullsv;    MAGIC *mg;    if (SvROK(in)) {        SV *rv = (SV*)SvRV(in);        switch (SvTYPE(rv)) {          case SVt_PVMG:            sv = rv;            break;          case SVt_PVHV:            sv = modperl_hv_request_find(aTHX_ in, classname, cv);            break;          default:            Perl_croak(aTHX_ "panic: unsupported request_rec type %d",                       SvTYPE(rv));        }    }    /* might be Apache2::ServerRec::warn method */    if (!sv && !(classname && SvPOK(in) && !strEQ(classname, SvPVX(in)))) {        request_rec *r = NULL;        (void)modperl_tls_get_request_rec(&r);        if (!r) {            Perl_croak(aTHX_                       "Apache2->%s called without setting Apache2->request!",                       cv ? GvNAME(CvGV(cv)) : "unknown");        }        return r;    }    /* there could be pool magic attached to custom $r object, so make     * sure that mg->mg_ptr is set */    if ((mg = mg_find(sv, PERL_MAGIC_ext)) && mg->mg_ptr) {        return (request_rec *)mg->mg_ptr;    }    else {        if (classname && !sv_derived_from(in, classname)) {            /* XXX: find something faster than sv_derived_from */            return NULL;        }        return INT2PTR(request_rec *, SvIV(sv));    }    return NULL;}