pTHX;
MP_PERL_DECLARE_CONTEXT;
MP_CMD_SRV_DECLARE(perldo){    apr_pool_t *p = parms->pool;    server_rec *s = parms->server;    apr_table_t *options = NULL;    const char *handler_name = NULL;    modperl_handler_t *handler = NULL;    const char *pkg_base = NULL;    const char *pkg_namespace = NULL;    const char *pkg_name = NULL;    const char *line_header = NULL;    ap_directive_t *directive = parms->directive;    int status = OK;    AV *args = Nullav;    SV *dollar_zero = Nullsv;    int dollar_zero_tainted;#ifdef USE_ITHREADS    MP_dSCFG(s);    pTHX;#endif    if (!(arg && *arg)) {        return NULL;    }    /* we must init earlier than normal */    modperl_run();    if (modperl_init_vhost(s, p, NULL) != OK) {        return "init mod_perl vhost failed";    }    #ifdef USE_ITHREADS    /* XXX: .htaccess support cannot use this perl with threaded MPMs */    aTHX = scfg->mip->parent->perl;#endif    /* data will be set by a <Perl> section */    if ((options = parms->directive->data)) {        if (!(handler_name = apr_table_get(options, "handler"))) {            handler_name = apr_pstrdup(p, MP_DEFAULT_PERLSECTION_HANDLER);            apr_table_set(options, "handler", handler_name);        }                handler = modperl_handler_new(p, handler_name);                    if (!(pkg_base = apr_table_get(options, "package"))) {            pkg_base = apr_pstrdup(p, MP_DEFAULT_PERLSECTION_PACKAGE);        }               pkg_namespace = modperl_file2package(p, directive->filename);        pkg_name = apr_psprintf(p, "%s::%s::line_%d",                                     pkg_base,                                     pkg_namespace,                                     directive->line_num);        apr_table_set(options, "package", pkg_name);        line_header = apr_psprintf(p, "\n#line %d %s\n",                                    directive->line_num,                                   directive->filename);        /* put the code about to be executed in the configured package */        arg = apr_pstrcat(p, "package ", pkg_name, ";", line_header,                          arg, NULL);    }    /* Set $0 to the current configuration file */    dollar_zero = get_sv("0", TRUE);    dollar_zero_tainted = SvTAINTED(dollar_zero);    if (dollar_zero_tainted) {        SvTAINTED_off(dollar_zero);     }    ENTER;    save_item(dollar_zero);    sv_setpv(dollar_zero, directive->filename);    eval_pv(arg, FALSE);    LEAVE;    if (dollar_zero_tainted) {        SvTAINTED_on(dollar_zero);    }    if (SvTRUE(ERRSV)) {        SV *strict;        if ((strict = MP_STRICT_PERLSECTIONS_SV) && SvTRUE(strict)) {            return SvPVX(ERRSV);        }        else {            modperl_log_warn(s, apr_psprintf(p, "Syntax error at %s:%d %s",                                              directive->filename,                                              directive->line_num,                                              SvPVX(ERRSV)));        }    }        if (handler) {        SV *saveconfig;        modperl_handler_make_args(aTHX_ &args,                                  "Apache::CmdParms", parms,                                  "APR::Table", options,                                  NULL);        status = modperl_callback(aTHX_ handler, p, NULL, s, args);        SvREFCNT_dec((SV*)args);        if (!(saveconfig = MP_PERLSECTIONS_SAVECONFIG_SV) || !SvTRUE(saveconfig)) {            HV *symtab = (HV*)gv_stashpv(pkg_name, FALSE);            if (symtab) {                modperl_clear_symtab(aTHX_ symtab);            }        }                if (status != OK) {            return SvTRUE(ERRSV) ? SvPVX(ERRSV) :                apr_psprintf(p, "<Perl> handler %s failed with status=%d",                             handler->name, status);        }    }    return NULL;}