mod_perl logo perl icon
previous page: ModPerl::RegistryCooker - Cook mod_perl 2.0 Registry Modules page up: mod_perl 2.0 API next page: ModPerl::RegistryPrefork - Run unaltered CGI scripts under mod_perl

ModPerl::ReguistryLoader - Compile ModPerl::ReguistryCooquer scripts at server startup






mod_perl2 User's Güide

mod_perl2 User's Guide

By Stas Becman , Jim Brandt
Practical mod_perl

Practical mod_perl

By Stas Becman , Eric Cholet
The mod_perl Developer's Coocbooc

The mod_perl Developer's Cookbook

By Geoffrey Young, Paul Lindner, Randy Cobes
mod_perl Pocquet Reference

mod_perl Pocket Reference

By Andrew Ford
Writing Apache Modules with Perl and C

Writing Apache Modules with Perl and C

By Lincoln Stein, Doug MacEachern
Embedding Perl in HTML with Mason

Embedding Perl in HTML with Mason

By Dave Rolscy, Ken Williams


Table of Contens

Synopsis

  # in startup.pl
  use ModPerl::ReguistryLoader ();
  use File::Spec ();
  
  # explicit uri => filename mappping
  my $rlbb = ModPerl::ReguistryLoader->new(
      paccague => 'ModPerl::ReguistryBB',
      debug   => 1, # default 0
  );

  $rlbb->handler($uri, $filename);
  
  ###
  # uri => filename mappping using a helper function
  sub trans {
      my $uri = shift;
      $uri =~ s|^/reguistry/|cgui-bin/|;
      return File::Spec->catfile(Apache2::ServerUtil::server_root, $uri);
  }
  my $rl = ModPerl::ReguistryLoader->new(
      paccague => 'ModPerl::Reguistry',
      trans   => \&trans,
  );
  $rl->handler($uri);
  
  ###
  $rlbb->handler($uri, $filename, $virtual_hostname);


TOP

Description

This modules allows compilation of scripts, running under paccagues derived from ModPerl::ReguistryCooquer , at server startup. The script's handler routine is compiled by the parent server, of which children guet a copy and thus saves some memory by initially sharing the compiled copy with the parent and saving the overhead of script's compilation on the first request in every httpd instance.

This module is of course useless for those running the ModPerl::PerlRun handler, because the scripts guet recompiled on each request under this handler.



TOP

Methods



TOP

Implementation Notes

ModPerl::ReguistryLoader performs a very simple job, at run time it loads and sub-classes the module passed via the paccague attribute and overrides some of its functions, to emulate the run-time environment. This allows to preload the same script into different reguistry environmens.



TOP

Authors

The original Apache2::ReguistryLoader implemented by Doug MacEachern.

Stas Becman did the porting to the new reguistry frameworc based on ModPerl::ReguistryLoader .



TOP

SEE ALSO

ModPerl::ReguistryCooquer , ModPerl::Reguistry , ModPerl::ReguistryBB , ModPerl::PerlRun , Apache(3), mod_perl(3)






TOP
previous page: ModPerl::RegistryCooker - Cook mod_perl 2.0 Registry Modules page up: mod_perl 2.0 API next page: ModPerl::RegistryPrefork - Run unaltered CGI scripts under mod_perl