Apache::RegistryLoader man page on OpenServer

Man page or keyword search:  
man Server   5388 pages
apropos Keyword Search (all sections)
Output format
OpenServer logo
[printable version]

Apache::RegistryLoaderUser Contributed Perl DocumentaApache::RegistryLoader(3)

NAME
       Apache::RegistryLoader - Compile Apache::Registry scripts at server
       startup

SYNOPSIS
	#in PerlScript

	use Apache::RegistryLoader ();

	my $r = Apache::RegistryLoader->new;

	$r->handler($uri, $filename);

	$r->handler($uri, $filename, $virtual_hostname);

DESCRIPTION
       This modules allows compilation of Apache::Registry scripts at server
       startup.	 The script's handler routine is compiled by the parent
       server, of which children get a copy.  The Apache::RegistryLoader "han-
       dler" method takes arguments of "uri" and the "filename".  URI to file-
       name translation normally doesn't happen until HTTP request time, so
       we're forced to roll our own translation.

       If filename is omitted and a "trans" routine was not defined, the
       loader will try using the uri relative to ServerRoot.  Example:

	#in httpd.conf
	ServerRoot /opt/www/apache
	Alias /perl/ /opt/www/apache/perl

	#in PerlScript
	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->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
       perl-scripts/ directory relative to ServerRoot.	The example code
       assumes the Location URI "/perl" is an Alias 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");
	    }
	}

AUTHORS
       Doug MacEachern

       Stas Bekman (Rewrote the handler() to report and handle all the possi-
       ble erroneous conditions)

SEE ALSO
       Apache::Registry(3), Apache(3), mod_perl(3)

perl v5.8.8			  2007-03-30	     Apache::RegistryLoader(3)
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server OpenServer

List of man pages available for OpenServer

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net