GV *gv; if ((gv = modperl_mgv_lookup(aTHX_ handler->mgv_cv))) { cv = modperl_mgv_cv(gv); package_name = modperl_mgv_as_string(aTHX_ handler->mgv_cv, p, 1);
GV *gv = modperl_mgv_lookup(aTHX_ handler->mgv_cv); if (gv) { CV *cv = modperl_mgv_cv(gv); if (cv && SvMAGICAL(cv)) { MAGIC *mg = mg_find((SV*)(cv), '~'); init_handler_pv_code = mg ? mg->mg_ptr : NULL; } else {  return 0; }
int modperl_filter_resolve_init_handler(pTHX_ modperl_handler_t *handler,                                        apr_pool_t *p){    char *init_handler_pv_code;    char *package_name;    CV *cv;    MAGIC *mg;        if (handler->mgv_cv) {        GV *gv;        if ((gv = modperl_mgv_lookup(aTHX_ handler->mgv_cv))) {            cv = modperl_mgv_cv(gv);            package_name = modperl_mgv_as_string(aTHX_ handler->mgv_cv, p, 1);            /* fprintf(stderr, "PACKAGE: %s\n", package_name ); */        }    }    if (cv && SvMAGICAL(cv)) {        mg = mg_find((SV*)(cv), '~');        init_handler_pv_code = mg ? mg->mg_ptr : NULL;    }    else {        /* XXX: should we complain in such a case? */        return 0;    }        if (init_handler_pv_code) {        /* eval the code in the parent handler's package's context */        char *code = apr_pstrcat(p, "package ", package_name, ";",                                 init_handler_pv_code, NULL);        SV *sv = eval_pv(code, TRUE);        /* fprintf(stderr, "code: %s\n", code); */        modperl_handler_t *init_handler =            modperl_handler_new_from_sv(aTHX_ p, sv);        if (init_handler) {            MP_TRACE_h(MP_FUNC, "found init handler %s\n",                       modperl_handler_name(init_handler));            if (!init_handler->attrs & MP_FILTER_INIT_HANDLER) {                Perl_croak(aTHX_ "handler %s doesn't have "                           "the FilterInitHandler attribute set",                           modperl_handler_name(init_handler));            }                        handler->next = init_handler;            return 1;        }        else {            Perl_croak(aTHX_ "failed to eval code: %s", code);                    }    }    return 1;}