You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Tom Mornini <tm...@infomania.com> on 2000/02/17 05:12:42 UTC

Help with Apache::RegistryLoader

I'm going insane! In my startup.mpl file I have this code:

use File::Find;
use Apache::RegistryLoader();

initialize_scripts('/usr/local/apache-common/htdocs/');

sub initialize_scripts {

 my @roots=@_;
 my $num=0;

 for my $root (@roots) {

  warn "Initializing scripts under $root";

  find(
       sub {
        return unless /^.+\.(mtpl$|mpl$|cgi$)/; # is this a script

        my $path="$File::Find::dir/$_";
        return if $path=~m|/CVS/|;              # is this a CVS file?

        my ($uri)=$path=~/\Q$root\E(.+)/;       # capture URI portion

        $num++;

        warn "Initializing $num: $uri with $path";

        Apache::RegistryLoader->new->handler($uri,$path);
       },
       $root
      );
 }
}

This is what is making me insane: Run as-is the warn shows 10 scripts
pre-compiled, and perl-status agrees. The problem is that this is not all
of the scripts that exist within that directory tree, though it is all of
them in the highest level (I know this is somehow the problem, but I
can't quite grasp it...). If I comment out the call to
Apache::RegistryLoader then the warn shows 68 scripts, which is correct.
The other 58 are all in sub-directories of htdocs...

I've checked the $uri and $path being passed in and everything seems
correct.

How could a call to Apache::RegistryLoader alter the function of the
File::Find function? File::Find docs specifically mention not to alter $_
and I have tried local'ing it and personally saving and restoring it
myself, but to no avail.

Has anyone been here before?

-- 
-- Tom Mornini
-- InfoMania Printing and Prepress