=head1 NAME Apache::RegistryLoader - Compile Apache::Registry scripts at server startup =head1 Synopsis #in your Perl Startup script: use Apache::RegistryLoader (); my $r = Apache::RegistryLoader->new; $r->handler($uri, $filename); $r->handler($uri, $filename, $virtual_hostname); =head1 Description This modules allows compilation of C scripts at server startup. The script's handler routine is compiled by the parent server, of which children get a copy. The C C method takes arguments of C and the C. URI to filename translation normally doesn't happen until HTTP request time, so we're forced to roll our own translation. If filename is omitted and a C routine was not defined, the loader will try using the I relative to C. Example: #in httpd.conf ServerRoot /opt/www/apache Alias /perl/ /opt/www/apache/perl #in startup.pl use Apache::RegistryLoader (); #/opt/www/apache/perl/test.pl #is the script loaded from disk here: Apache::RegistryLoader->new->handler("/perl/test.pl"); To make the loader smarter about the uri-Efilename translation, you may provide the C method with a C function to translate the uri to filename. The following example will pre-load all files ending with C<.pl> in the I directory relative to C. The example code assumes the Location URI I is an C to this directory. { use Cwd (); use Apache::RegistryLoader (); use DirHandle (); use strict; my $dir = Apache->server_root_relative("perl-scripts/"); my $rl = Apache::RegistryLoader->new(trans => sub { my $uri = shift; $uri =~ s:^/perl/:/perl-scripts/:; return Apache->server_root_relative($uri); }); my $dh = DirHandle->new($dir) or die $!; for my $file ($dh->read) { next unless $file =~ /\.pl$/; $rl->handler("/perl/$file"); } } =head1 Maintainers Maintainer is the person(s) you should contact with updates, corrections and patches. =over =item * The L =back =head1 Authors =over =item * Doug MacEachern =item * Stas Bekman (Rewrote the C to report and handle all the possible erroneous conditions). =back Only the major authors are listed above. For contributors see the Changes file. =head1 See Also L, L, mod_perl =cut