All,

To begin with, should proposed mod_perl patches go to
[EMAIL PROTECTED]?  The documentation seemed a little unclear in this
case (I decided to play it safe since I didn't run across any messages
on the dev list from outside developers.)

When I was converting Apache::PAR to work with mod_perl 2.x, one problem
I had was with the way in which ModPerl::RegistryCooker stores member
data.  Any subclass of ModPerl::RegistryCooker (in my case, for
Apache::PAR::RegistryCooker) that need to store their own module data
have a problem - they need to pick an array element to store their data
in.  Because of the way in which ModPerl::RegistryCooker works
currently, that means hardcoding an array index (because not all array
members are created in new or init).  Thus, in
Apache::PAR::RegistryCooker I have a line similar to the following:

use constant PARDATA => 8;

This is not optimal, especially since this has already changed in the
CVS version of RegistryCooker since I started working on it - luckily,
to less members, not more :-)

I propose a change to RegistryCooker.pm so that member data is always
defined in the init sub, so that I could change the above line to
something more like:

use constant PARDATA => -1;

and in my handler, push a new element on after new has been called. 
This would keep future changes to the RegistryCooker script from
potentially breaking other modules which must store their own data as
well.

Below is a (small) patch to the CVS version of RegistryCooker.pm to do
this.  Down side is that if new member data is added, it would then also
need to be added to the init sub.

If you have any questions, please let me know.

*** RegistryCooker.pm.bak       Sun Feb  2 21:00:59 2003
--- RegistryCooker.pm   Sun Feb  2 21:10:51 2003
***************
*** 107,124 ****
--- 107,128 ----
  
 
#########################################################################
  # func: init
  # dflt: init
  # desc: initializes the data object's fields: REQ FILENAME URI
+ #       also declares other members not yet used
  # args: $r - Apache::Request object
  # rtrn: nothing
 
#########################################################################
  
  sub init {
      $_[0]->[REQ]      = $_[1];
      $_[0]->[URI]      = $_[1]->uri;
      $_[0]->[FILENAME] = $_[1]->filename;
+     $_[0]->[MTIME]    = undef;
+     $_[0]->[PACKAGE]  = undef;
+     $_[0]->[CODE]     = undef;
  }
  
 
#########################################################################
  # func: handler
  # dflt: handler


Thanks,

-- 
Nathan Byrd <[EMAIL PROTECTED]>

Reply via email to