On Mon, 30 Apr 2001, Pete Jordan wrote:

> I've been off this list for over a year, so I may be covering ground that 
> I've failed to find in the archives, but whatever...
> 
> I've had occasion to examine the internals of Apache::Registry recently[1] 
> and have been reminded of the unfeasably long package names that it 
> generates for scripts.
> 
> It occurs to me that there would be no overhead to speak of in using a 
> sequence number, given that Apache::Registry already maintains a hash for 
> its generated package names for mtime checks. Something like:
> 
>       my $script=
>         $Apache::Registry->{$script_name}||=
>           {seq => ++$Apache::Registry::seq, mtime => $mtime+1};
> 
>       my $package=sprintf "Apache::MAIN::S%04d", $script->{seq};
> 
>       $r->log_error("Apache::Registry::handler package $package")
>          if $Debug && $Debug & 4;
> 
>       $r->chdir_file;
> 
>       unless ($script->{mtime} <= $mtime) {
>         $script->{mtime}=$mtime;
>         $package=sprintf "Apache::MAIN::S%04d", $script->{seq};
> 
>         # compile into $package
>       }
> 
>       my $old_status = $r->status;
> 
>       my $cv = \&{"$package\::handler"};
>       eval { &{$cv}($r, @_) } if $r->seqno;
> 
>       # and so on...

This would be trivial to do. Just implement a package derived from
Apache::RegistryNG (e.g. Apache::MyRegistry) that implements a single
method namespace().

-- 
<Matt/>

    /||    ** Founder and CTO  **  **   http://axkit.com/     **
   //||    **  AxKit.com Ltd   **  ** XML Application Serving **
  // ||    ** http://axkit.org **  ** XSLT, XPathScript, XSP  **
 // \\| // ** mod_perl news and resources: http://take23.org  **
     \\//
     //\\
    //  \\

Reply via email to