Manual Pages for UNIX Darwin command on man ModPerl::RegistryCooker
MyWebUniversity

Manual Pages for UNIX Darwin command on man ModPerl::RegistryCooker

aappaacchheemmooddppeerrll-110011..11~~2U2:s::e:mrmoodCdopnpeterrrlil-b-2u2.t.0e0.d.22:P::e:drdoloccsDs:o::c:auapmpiei:n::t:MaMotodidPoPenerrll::::RReeggiissttrryyCCooookkeerr((33))

NAME

ModPerl::RegistryCooker - Cook modperl 2.0 Registry Modules

SSyynnooppssiiss

# shouldn't be used as-is but sub-classed first

# see ModPerl::Registry for an example

DDeessccrriippttiioonn

"ModPerl::RegistryCooker" is used to create flexible and overridable

registry modules which emulate modcgi for Perl scripts. The concepts are discussed in the manpage of the following modules: "ModPerl::Registry", "ModPerl::Registry" and "ModPerl::RegistryBB".

"ModPerl::RegistryCooker" has two purposes:

+o Provide ingredients that can be used by registry sub-classes

+o Provide a default behavior, which can be overriden in sub-classed

META: in the future this functionality may move into a separate class. Here are the current overridable methods: META: these are all documented in RegistryCooker.pm, though not using pod. please help to port these to pod and move the descriptions here. +o new() create the class's object, bless it and return it

my $obj = $class->new($r);

$class - the registry class, usually "PACKAGE" can be used.

$r - "Apache2::Request" object.

default: new() +o init()

initializes the data object's fields: "REQ", "FILENAME", "URI".

Called from the new(). default: init() +o defaulthandler() default: defaulthandler() +o run() default: run() +o cancompile() default: cancompile() +o makenamespace() default: makenamespace() +o namespaceroot() default: namespaceroot() +o namespacefrom() If "namespacefromuri" is used and the script is called from the virtual host, by default the virtual host name is prepended to the uri when package name for the compiled script is created. Sometimes this behavior is undesirable, e.g., when the same (physical) script is accessed using the same pathinfo but different virtual hosts. In that case you can make the script compiled only once for all vhosts, by specifying:

$ModPerl::RegistryCooker::NameWithVirtualHost = 0;

The drawback is that it affects the global environment and all other scripts will be compiled ignoring virtual hosts. default: namespacefrom() +o iscached() default: iscached() +o shouldcompile() default: shouldcompile() +o flushnamespace() default: flushnamespace() +o cachetable() default: cachetable() +o cacheit() default: cacheit() +o readscript() default: readscript() +o shebangtoperl() default: shebangtoperl() +o getscriptname() default: getscriptname() +o chdirfile() default: chdirfile() +o getmarkline() default: getmarkline() +o compile() default: compile() +o errorcheck() default: errorcheck() +o stripenddatasegment() default: stripenddatasegment() +o convertscripttocompiledhandler() default: convertscripttocompiledhandler() SSppeecciiaall PPrreeddeeffiinneedd FFuunnccttiioonnss The following functions are implemented as constants. +o NOP() Use when the function shouldn't do anything. +o TRUE() Use when a function should always return a true value. +o FALSE() Use when a function should always return a false value.

SSuubb-ccllaassssiinngg TTeecchhnniiqquueess

To override the default "ModPerl::RegistryCooker" methods, first, sub-

class "ModPerl::RegistryCooker" or one of its existing sub-classes,

using "use base". Second, override the methods. Those methods that weren't overridden will be resolved at run time when used for the first time and cached for the future requests. One way to to shortcut this first run resolution is to use the symbol aliasing feature. For example to alias "ModPerl::MyRegistry::flushnamespace" as

"ModPerl::RegistryCooker::flushnamespace", you can do:

package ModPerl::MyRegistry;

use base qw(ModPerl::RegistryCooker);

*ModPerl::MyRegistry::flushnamespace =

\&ModPerl::RegistryCooker::flushnamespace;

1; In fact, it's a good idea to explicitly alias all the methods so you know exactly what functions are used, rather then relying on the

defaults. For that purpose "ModPerl::RegistryCooker" class method

installaliases() can be used. Simply prepare a hash with method names in the current package as keys and corresponding fully qualified methods to be aliased for as values and pass it to installaliases(). Continuing our example we could do: package ModPerl::MyRegistry;

use base qw(ModPerl::RegistryCooker);

my %aliases = (

flushnamespace => 'ModPerl::RegistryCooker::flushnamespace',

);

PACKAGE->installaliases(\%aliases);

1; The values use fully qualified packages so you can mix methods from different classes. EExxaammpplleess The best examples are existing core registry modules: "ModPerl::Registry", "ModPerl::Registry" and "ModPerl::RegistryBB". Look at the source code and their manpages to see how they subclass

"ModPerl::RegistryCooker".

For example by default "ModPerl::Registry" uses the script's path when creating a package's namespace. If for example you want to use a uri instead you can override it with: *ModPerl::MyRegistry::namespacefrom =

\&ModPerl::RegistryCooker::namespacefromuri;

1; Since the "namespacefromuri" component already exists in

"ModPerl::RegistryCooker". If you want to write your own method, e.g.,

that creates a namespace based on the inode, you can do: sub namespacefrominode {

my $self = shift;

return (stat $self->[FILENAME])[1];

}

META: when $r->finfo will be ported it'll be more effecient. (stat

$r->finfo)[1]

AAuutthhoorrss Doug MacEachern Stas Bekman SSeeee AAllssoo "ModPerl::Registry", "ModPerl::RegistryBB" and "ModPerl::PerlRun".

paepralchve5.m8o.d8perl-101.1~2::modperl-220.005.-21:0:-d2o0cs::api::ModPerl::RegistryCooker(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™