status = modperl_callback(aTHX_ handlers[i], p);
if ((status = modperl_callback(aTHX_ handlers[i], p)) != OK) { status = modperl_errsv(aTHX_ status, r, s); }
int modperl_run_handlers(int idx, request_rec *r, conn_rec *c,                         server_rec *s, int type, ...){#ifdef USE_ITHREADS    pTHX;    modperl_interp_t *interp = NULL;#endif    MP_dSCFG(s);    MP_dDCFG;    modperl_handler_t **handlers;    apr_pool_t *p = NULL;    MpAV *av = NULL;    int i, status = OK;    const char *desc = NULL;    va_list args;    AV *av_args = Nullav;    if (!MpSrvENABLED(scfg)) {        MP_TRACE_h(MP_FUNC, "PerlOff for server %s\n",                   s->server_hostname);        return DECLINED;    }    switch (type) {      case MP_HANDLER_TYPE_DIR:        av = dcfg->handlers[idx];        MP_TRACE_a_do(desc = modperl_per_dir_handler_desc(idx));        break;      case MP_HANDLER_TYPE_SRV:        av = scfg->handlers[idx];        MP_TRACE_a_do(desc = modperl_per_srv_handler_desc(idx));        break;      case MP_HANDLER_TYPE_CONN:        av = scfg->connection_cfg->handlers[idx];        MP_TRACE_a_do(desc = modperl_connection_handler_desc(idx));        break;      case MP_HANDLER_TYPE_FILE:        av = scfg->files_cfg->handlers[idx];        MP_TRACE_a_do(desc = modperl_files_handler_desc(idx));        break;      case MP_HANDLER_TYPE_PROC:        av = scfg->process_cfg->handlers[idx];        MP_TRACE_a_do(desc = modperl_process_handler_desc(idx));        break;    };    if (!av) {        MP_TRACE_h(MP_FUNC, "no %s handlers configured (%s)\n",                   desc, r ? r->uri : "");        return DECLINED;    }#ifdef USE_ITHREADS    if (r || c) {        p = c ? c->pool : r->pool;        interp = modperl_interp_select(r, c, s);        aTHX = interp->perl;    }    else {        /* Child{Init,Exit}, OpenLogs */        aTHX = scfg->mip->parent->perl;    }    PERL_SET_CONTEXT(aTHX);#endif    MP_TRACE_h(MP_FUNC, "running %d %s handlers\n",               av->nelts, desc);    handlers = (modperl_handler_t **)av->elts;    av_args = newAV();    switch (type) {      case MP_HANDLER_TYPE_DIR:      case MP_HANDLER_TYPE_SRV:        modperl_handler_make_args(aTHX_ av_args,                                  "Apache", r, NULL);        break;      case MP_HANDLER_TYPE_CONN:        modperl_handler_make_args(aTHX_ av_args,                                  "Apache::Connection", c, NULL);        break;      case MP_HANDLER_TYPE_FILE:          {              apr_pool_t *pconf, *plog, *ptemp;              va_start(args, type);              pconf = va_arg(args, apr_pool_t *);              plog  = va_arg(args, apr_pool_t *);              ptemp = va_arg(args, apr_pool_t *);              va_end(args);              modperl_handler_make_args(aTHX_ av_args,                                        "Apache::Pool", pconf,                                        "Apache::Pool", plog,                                        "Apache::Pool", ptemp,                                        "Apache::Server", s, NULL);          }          break;      case MP_HANDLER_TYPE_PROC:          {              apr_pool_t *p;              va_start(args, type);              p = va_arg(args, apr_pool_t *);              va_end(args);              modperl_handler_make_args(aTHX_ av_args,                                        "Apache::Pool", p,                                        "Apache::Server", s, NULL);          }          break;    };    for (i=0; i<av->nelts; i++) {        if (!handlers[i]->perl) {            handlers[i]->perl = aTHX;        }        handlers[i]->args = av_args;        status = modperl_callback(aTHX_ handlers[i], p);        handlers[i]->args = Nullav;        MP_TRACE_h(MP_FUNC, "%s returned %d\n",                   handlers[i]->name, status);    }    SvREFCNT_dec((SV*)av_args);#ifdef USE_ITHREADS    if (interp && MpInterpPUTBACK_On(interp)) {        /* XXX: might want to put interp back into available pool         * rather than have it marked as in_use for the lifetime of         * a request         */    }#endif    return status;}