When creating a new ModPerl::RegistryLoader object, one has to
specify which of the ModPerl::RegistryCooker derived modules to
use. For example if a script is going to run under
ModPerl::RegistryBB the object is initialized as:
If the package is not specified ModPerl::Registry is assumed:
To turn the debugging on, set the debug attribute to a true value:
Instead of specifying explicitly a filename for each uri passed to handler(), a special attribute trans can be set to a subroutine to perform automatic remapping.
See the handler() item for an example of using the trans attribute.
$rl->handler($uri, [$filename, [$virtual_hostname]]);
The handler() method takes argument of uri and optionally of filename and of virtual_hostname.
If the filename is omitted and a trans subroutine was not set in new(), the loader will try using the uri relative to the ServerRoot configuration directive. For example:
To make the loader smarter about the URI->filename translation, you may provide the new() method with a trans() function to translate the uri to filename.
The following example will pre-load all files ending with .pl in the cgi-bin directory relative to ServerRoot.
If $virtual_hostname argument is passed itll be used in the creation of the package name the script will be compiled into for those registry handlers that use namespace_from_uri() method. See also the notes on $ModPerl::RegistryCooker::NameWithVirtualHost in the ModPerl::RegistryCooker documentation.
Also explained in the ModPerl::RegistryLoader documentation, this only has an effect at run time if $ModPerl::RegistryCooker::NameWithVirtualHost is set to true, otherwise the $virtual_hostname argument is ignored.
ModPerl::RegistryLoader performs a very simple job, at run time it loads and sub-classes the module passed via the package attribute and overrides some of its functions, to emulate the run-time environment. This allows to preload the same script into different registry environments.
The original Apache2::RegistryLoader implemented by Doug MacEachern.
Stas Bekman did the porting to the new registry framework based on ModPerl::RegistryLoader.
ModPerl::RegistryCooker, ModPerl::Registry, ModPerl::RegistryBB, ModPerl::PerlRun, Apache(3), mod_perl(3)
|perl v5.20.3||WORK::MOD_PERL-2.0.9::DOCS::API::MODPERL::REGISTRYLOADER (3)||2015-06-18|