dougm       00/12/29 21:09:01

  Modified:    .        Changes
               lib/Apache ExtUtils.pm
               src/modules/perl mod_perl.h perl_config.c
  Log:
  fix directive handlers bug triggered by LoadModule foo_module
  
  Revision  Changes    Path
  1.566     +2 -0      modperl/Changes
  
  Index: Changes
  ===================================================================
  RCS file: /home/cvs/modperl/Changes,v
  retrieving revision 1.565
  retrieving revision 1.566
  diff -u -r1.565 -r1.566
  --- Changes   2000/12/29 17:10:06     1.565
  +++ Changes   2000/12/30 05:08:55     1.566
  @@ -10,6 +10,8 @@
   
   =item 1.24_02-dev
   
  +fix directive handlers bug triggered by LoadModule foo_module
  +
   allow $r->finfo to be modified
   
   if Perl is linked with -lpthread, then httpd needs to be linked with
  
  
  
  1.22      +25 -3     modperl/lib/Apache/ExtUtils.pm
  
  Index: ExtUtils.pm
  ===================================================================
  RCS file: /home/cvs/modperl/lib/Apache/ExtUtils.pm,v
  retrieving revision 1.21
  retrieving revision 1.22
  diff -u -r1.21 -r1.22
  --- ExtUtils.pm       2000/12/23 02:23:09     1.21
  +++ ExtUtils.pm       2000/12/30 05:08:57     1.22
  @@ -122,6 +122,9 @@
   sub xs_cmd_table {
       my($self, $class, $cmds) = @_;
       (my $modname = $class) =~ s/::/__/g;
  +    (my $pmname = $class) =~ s,::,/,g;
  +    $pmname .= '.pm';
  +
       my $cmdtab = "";
       my $infos = "";
   
  @@ -252,6 +255,25 @@
       NULL,   /* [1] post read_request handling */
   };
   
  +#define this_module "$pmname"
  +
  +static void remove_module_cleanup(void *data)
  +{
  +    if (find_linked_module("$class")) {
  +        /* need to remove the module so module index is reset */
  +        remove_module(&XS_${modname});
  +    }
  +    if (data) {
  +        /* make sure BOOT section is re-run on restarts */
  +        (void)hv_delete(GvHV(incgv), this_module,
  +                        strlen(this_module), G_DISCARD);
  +         if (dowarn) {
  +             /* avoid subroutine redefined warnings */
  +             perl_clear_symtab(gv_stashpv("$class", FALSE));
  +         }
  +    }
  +}
  +
   MODULE = $class              PACKAGE = $class
   
   PROTOTYPES: DISABLE
  @@ -260,14 +282,14 @@
       XS_${modname}.name = "$class";
       add_module(&XS_${modname});
       stash_mod_pointer("$class", &XS_${modname});
  +    register_cleanup(perl_get_startup_pool(), (void *)1,
  +                     remove_module_cleanup, null_cleanup);
   
   void
   END()
   
       CODE:
  -    if (find_linked_module("$class")) {
  -        remove_module(&XS_${modname});
  -    }
  +    remove_module_cleanup(NULL);
   EOF
   }
   
  
  
  
  1.107     +1 -0      modperl/src/modules/perl/mod_perl.h
  
  Index: mod_perl.h
  ===================================================================
  RCS file: /home/cvs/modperl/src/modules/perl/mod_perl.h,v
  retrieving revision 1.106
  retrieving revision 1.107
  diff -u -r1.106 -r1.107
  --- mod_perl.h        2000/12/20 07:24:43     1.106
  +++ mod_perl.h        2000/12/30 05:08:59     1.107
  @@ -1210,6 +1210,7 @@
   void perl_perl_cmd_cleanup(void *data);
   
   void perl_section_self_boot(cmd_parms *parms, void *dummy, const char *arg);
  +void perl_clear_symtab(HV *symtab);
   CHAR_P perl_section (cmd_parms *cmd, void *dummy, CHAR_P arg);
   CHAR_P perl_end_section (cmd_parms *cmd, void *dummy);
   CHAR_P perl_pod_section (cmd_parms *cmd, void *dummy, CHAR_P arg);
  
  
  
  1.108     +5 -2      modperl/src/modules/perl/perl_config.c
  
  Index: perl_config.c
  ===================================================================
  RCS file: /home/cvs/modperl/src/modules/perl/perl_config.c,v
  retrieving revision 1.107
  retrieving revision 1.108
  diff -u -r1.107 -r1.108
  --- perl_config.c     2000/09/28 03:53:01     1.107
  +++ perl_config.c     2000/12/30 05:08:59     1.108
  @@ -1675,7 +1675,7 @@
       }   
   }
   
  -static void clear_symtab(HV *symtab) 
  +void perl_clear_symtab(HV *symtab) 
   {
       SV *val;
       char *key;
  @@ -1686,6 +1686,7 @@
        SV *sv;
        HV *hv;
        AV *av;
  +     CV *cv;
        dTHR;
   
        if((SvTYPE(val) != SVt_PVGV) || GvIMPORTED((GV*)val))
  @@ -1696,6 +1697,8 @@
            hv_clear(hv);
        if((av = GvAV((GV*)val)))
            av_clear(av);
  +     if((cv = GvCV((GV*)val)))
  +         cv_undef(cv);
       }
   }
   
  @@ -1830,7 +1833,7 @@
        if(usv && SvTRUE(usv))
            ; /* keep it around */
        else
  -         clear_symtab(symtab);
  +         perl_clear_symtab(symtab);
       }
       return NULL;
   }
  
  
  

Reply via email to