perl-Apache-EmbeddedPerl-Lite-0.06-alt1 P > @
, 0 7ea15f2a13916616c77bd51aec8f0211fe289f80 p|
) > 3 ? q d % * L
* ; q w
.
4 L j
$
(
8
9
:
F
G H I 8 X @ Y H \ X ] p ^ b R d e e j f o C perl-Apache-EmbeddedPerl-Lite 0.06 alt1 light weight embedded perl parser This modules is a light weight perl parser designed to be used in
conjunction wit mod_perl and Apache 1 or Apache 2. It may be used as a
handler for files containing embedded perl or it may be called as a
subroutine to conditionally parse files of your choosing.
Perl code may be embedded in a file parsed by this module as described
below. Each section of perl code is collected and eval'd as a subroutine that
is passed the two arguments ($classnam,$r) in its input array @_;
Embedded perl should have the following format:
On a line by itself:
{optional whitespace}
The beginning and terminating brackets may optionally be followed by a white
space and comments, which will be ignored.
i.e.
=item * $http_response = handler($classname,$r);
The function "handler" has the prototype:
_handler ($$) : method {
which receives the arguments $class, $r from Apache mod_perl.
input:_class name,_(a scalar, not a ref)
__request handle
return:_Apache response code or undef
handler is not exported.
Expected Codes:
_ 0_OK
_404_File Not Found
_500_Server Error
404 could not find, open, etc... file
500 missing closing embedded perl bracket
embedded perl has an error
When a 500 error is returned, a warning will be issued to STDERR providing
details about the error.
_
A ContentType header will not be sent unless the type is specified as
follows:
_PerlSetVar_ContentType_text/html
mod_perl configuration is as follows:
PerlModule Apache::EmbeddedPerl::Lite
SetHandler perl-script
PerlHandler Apache::EmbeddedPerl::Lite
PerlSetVar ContentType text/html
=item * $http_response = embedded($classname,$r,$file,@args);
The function "embedded" is similar to "handler" above except that it does not send any headers.
Headers are the responsibility of the application "handler", or the embedded
code.
@args are optional arguments that may be passed from your handler to embedded.
input:_class name,_(a scalar, not a ref)
__request handle,
__file name
__@args_[optional] appication specific
return:_Apache response code or undef
... at startup or .httaccess ...
use Apache::EmbeddedPerl::Lite qw(embedded);
... in the application handler ...
_if ($r->filename =~ /\.ebhtml$/) {
..._ set content type, etc...
_ $response = embedded(__PACKAGE__,$r,$r->filename);
_} else {
_ $response = embedded(__PACKAGE__,$r,$someotherfile);
_}
_return $response if $response; # contains error
..._ do something else S_igor.hasher.altlinux.org )]ALT Linux ALT Linux Team perl Igor Vlasenko