perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From do...@apache.org
Subject cvs commit: modperl-2.0/src/modules/perl modperl_mgv.c modperl_util.c modperl_util.h
Date Wed, 25 Apr 2001 03:13:59 GMT
dougm       01/04/24 20:13:59

  Modified:    src/modules/perl modperl_mgv.c modperl_util.c modperl_util.h
  Log:
  be less noisy about failed requires if our last guess succeeds
  
  Revision  Changes    Path
  1.14      +14 -3     modperl-2.0/src/modules/perl/modperl_mgv.c
  
  Index: modperl_mgv.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_mgv.c,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- modperl_mgv.c	2001/04/19 21:26:35	1.13
  +++ modperl_mgv.c	2001/04/25 03:13:58	1.14
  @@ -291,7 +291,7 @@
           MP_TRACE_h(MP_FUNC,
                      "package %s not defined, attempting to load\n", name);
   
  -        if (modperl_require_module(aTHX_ name)) {
  +        if (modperl_require_module(aTHX_ name, FALSE)) {
               MP_TRACE_h(MP_FUNC, "loaded %s package\n", name);
               if (!(stash = gv_stashpv(name, FALSE))) {
                   MP_TRACE_h(MP_FUNC, "%s package still does not exist\n",
  @@ -300,6 +300,8 @@
               }
           }
           else {
  +            I32 errlen = 0;
  +            char *errpv;
               int ix = ap_rind(name, ':');
               stash = Nullhv;
   
  @@ -311,13 +313,22 @@
                   char *try_package = apr_pstrndup(p, name, ix-1);
                   handler_name = apr_pstrdup(p, name + ix + 1);
   
  -                if (modperl_require_module(aTHX_ try_package)) {
  +                /* if this fails we want to log $@ from failure above */
  +                errlen = SvCUR(ERRSV);
  +                errpv  = apr_pstrndup(p, SvPVX(ERRSV), errlen);
  +
  +                if (modperl_require_module(aTHX_ try_package, FALSE)) {
                       MP_TRACE_h(MP_FUNC, "loaded %s package\n", try_package);
                       stash = gv_stashpv(try_package, FALSE);
                   }
               }
   
               if (!stash) {
  +                if (errlen) {
  +                    sv_setpvn(ERRSV, errpv, errlen);
  +                }
  +                (void)modperl_errsv(aTHX_ HTTP_INTERNAL_SERVER_ERROR,
  +                                    NULL, NULL);
                   MP_TRACE_h(MP_FUNC, "failed to load %s package\n", name);
                   return 0;
               }
  @@ -385,7 +396,7 @@
       char *package =
           modperl_mgv_as_string(aTHX_ symbol, p, 1);
   
  -    if (modperl_require_module(aTHX_ package)) {
  +    if (modperl_require_module(aTHX_ package, TRUE)) {
           MP_TRACE_h(MP_FUNC, "reloaded %s for server %s\n",
                      package, modperl_server_desc(s, p));
           return TRUE;
  
  
  
  1.8       +5 -2      modperl-2.0/src/modules/perl/modperl_util.c
  
  Index: modperl_util.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- modperl_util.c	2001/04/20 01:57:25	1.7
  +++ modperl_util.c	2001/04/25 03:13:59	1.8
  @@ -1,6 +1,6 @@
   #include "mod_perl.h"
   
  -int modperl_require_module(pTHX_ const char *pv)
  +int modperl_require_module(pTHX_ const char *pv, int logfailure)
   {
       SV *sv;
   
  @@ -15,7 +15,10 @@
       POPSTACK;
   
       if (SvTRUE(ERRSV)) {
  -        (void)modperl_errsv(aTHX_ HTTP_INTERNAL_SERVER_ERROR, NULL, NULL);
  +        if (logfailure) {
  +            (void)modperl_errsv(aTHX_ HTTP_INTERNAL_SERVER_ERROR,
  +                                NULL, NULL);
  +        }
           return FALSE;
       }
           
  
  
  
  1.9       +1 -1      modperl-2.0/src/modules/perl/modperl_util.h
  
  Index: modperl_util.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- modperl_util.h	2001/04/20 01:57:25	1.8
  +++ modperl_util.h	2001/04/25 03:13:59	1.9
  @@ -27,7 +27,7 @@
   
   int modperl_errsv(pTHX_ int status, request_rec *r, server_rec *s);
   
  -int modperl_require_module(pTHX_ const char *pv);
  +int modperl_require_module(pTHX_ const char *pv, int logfailure);
   
   char *modperl_server_desc(server_rec *s, apr_pool_t *p);
   
  
  
  

Mime
View raw message