Manual Pages for UNIX Darwin command on man Apache::Registry
MyWebUniversity

Manual Pages for UNIX Darwin command on man Apache::Registry

Apache::Registry(3) User Contributed Perl Documentation Apache::Registry(3)

NAME

Apache::Registry - Run unaltered CGI scrips under modperl

SYNOPSIS

#in httpd.conf

Alias /perl/ /perl/apache/scripts/ #optional

PerlModule Apache::Registry

SetHandler perl-script

PerlHandler Apache::Registry

Options ExecCGI

DESCRIPTION

URIs in the form of "http://www.host.com/perl/file.pl" will be compiled as the body of a perl subroutine and executed. Each server process or 'child' will compile the subroutine once and store it in memory. It will recompile it whenever the file is updated on disk. Think of it as an object oriented server with each script implementing a class loaded at runtime. The file looks much like a "normal" script, but it is compiled or 'evaled' into a subroutine. Here's an example:

my $r = Apache->request;

$r->contenttype("text/html");

$r->sendhttpheader;

$r->print("Hi There!");

This module emulates the CGI environment, allowing programmers to write scripts that run under CGI or modperl without change. Existing CGI scripts may require some changes, simply because a CGI script has a very short lifetime of one HTTP request, allowing you to get away with

"quick and dirty" scripting. Using modperl and Apache::Registry

requires you to be more careful, but it also gives new meaning to the word "quick"! Be sure to read all modperl related documentation for more details, including instructions for setting up an environment that looks exactly like CGI:

print "Content-type: text/html\n\n";

print "Hi There!"; Note that each httpd process or "child" must compile each script once, so the first request to one server may seem slow, but each request there after will be faster. If your scripts are large and/or make use of many Perl modules, this difference should be noticeable to the human eye. SSEECCUURRIITTYY

Apache::Registry::handler will preform the same checks as modcgi

before running the script. ENVIRONMENT

The Apache function `exit' overrides the Perl core built-in function.

The environment variable GGAATTEEWWAAYYIINNTTEERRFFAACCEE is set to "CGI-Perl/1.1".

CCOOMMMMAANNDDLLIINNEE SSWWIITTCCHHEESS IINN FFIIRRSSTT LLIINNEE Normally when a Perl script is run from the command line or under CGI,

arguments on the `#!' line are passed to the perl interpreter for pro-

cessing.

Apache::Registry currently only honors the -ww switch and will turn on

warnings using the $^W global variable. Another common switch used

with CGI scripts is -TT to turn on taint checking. This can only be

enabled when the server starts with the configuration directive: PerlTaintCheck On

However, if taint checking is not enabled, but the -TT switch is seen,

Apache::Registry will write a warning to the errorlog.

DDEEBBUUGGGGIINNGG

You may set the debug level with the $Apache::Registry::Debug bitmask

1 => log recompile in errorlog

2 => Apache::Debug::dump in case of $@

4 => trace pedantically CCAAVVEEAATTSS

Apache::Registry makes things look just the CGI environment, however,

you must understand that this *is not CGI*. Each httpd child will com-

pile your script into memory and keep it there, whereas CGI will run it once, cleaning out the entire process space. Many times you have heard

"always use "-w", always use "-w" and 'use strict'". This is more

important here than anywhere else! Your scripts cannot contain the END or DATA token to terminate compilation.

SEE ALSO

perl(1), modperl(3), Apache(3), Apache::Debug(3) AUTHORS Andreas J. Koenig and Doug MacEachern

perl v5.8.6 2000-03-30 Apache::Registry(3)




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