Apache2-SSI
view release on metacpan or search on metacpan
It tries hard to find the Apache configuration file. You can help it by
providing command line modifiers, such as:
perl Makefile.PL -apxs /usr/bin/apxs
or, even specify the Apache configuration file:
perl Makefile.PL -apxs /usr/bin/apxs -httpd_conf /home/john/etc/apache2/apache2.conf
To run only some tests, for example:
make test TEST_FILES="./t/31.file.t"
If you are on a Linux type system, you can install "apxs" by issuing on
the command line:
apt install apache2-dev
You can check if you have it installed with the following command:
dpkg -l | grep apache
See ExtUtils::MakeMaker for more information.
METHODS
new
This instantiate an object that is used to access other key methods. It
takes the following parameters:
*apache_filter*
This is the Apache2::Filter object object that is provided if
running under mod_perl.
*apache_request*
This is the Apache2::RequestRec object that is provided if running
under mod_perl.
it can be retrieved from "request" in Apache2::RequestUtil or via
"r" in Apache2::Filter
You can get this Apache2::RequestRec object by requiring
Apache2::RequestUtil and calling its class method "request" in
Apache2::RequestUtil such as Apache2::RequestUtil->request and
assuming you have set "PerlOptions +GlobalRequest" in your Apache
Virtual Host configuration.
Note that there is a main request object and subprocess request
object, so to find out which one you are dealing with, use
"is_initial_req" in Apache2::RequestUtil, such as:
use Apache2::RequestUtil (); # extends Apache2::RequestRec objects
my $r = $r->is_initial_req ? $r : $r->main;
*debug*
Sets the debug level. Starting from 3, this will output on the
STDERR or in Apache error log a lot of debugging output.
*document_root*
This is only necessary to be provided if this is not running under
Apache mod_perl. Without this value, Apache2::SSI has no way to
guess the document root and will not be able to function properly
and will return an "error".
*document_uri*
This is only necessary to be provided if this is not running under
Apache mod_perl. This must be the uri of the document being served,
such as "/my/path/index.html". So, if you are using this outside of
the rim of Apache mod_perl and your file resides, for example, at
"/home/john/www/my/path/index.html" and your document root is
"/home/john/www", then the document uri would be
"/my/path/index.html"
*errmsg*
The error message to be returned when a ssi directive fails. By
default, it is "[an error occurred while processing this directive]"
*html*
The html data to be parsed. You do not have to provide that value
now. You can provide it to "parse" as its first argument when you
call it.
*legacy*
Takes a boolean value suchas 1 or 0 to indicate whether the Apache2
expression supported accepts legacy style.
Legacy Apache expression typically allows for perl style variable
"${REQUEST_URI}" versus the modern style of "%{REQUEST_URI}" and
just an equal sign to imply a regular expression such as:
$HTTP_COOKIES = /lang\%22\%3A\%22([a-zA-Z]+\-[a-zA-Z]+)\%22\%7D;?/
Modern expression equivalent would be:
%{HTTP_COOKIES} =~ /lang\%22\%3A\%22([a-zA-Z]+\-[a-zA-Z]+)\%22\%7D;?/
See Regexp::Common::Apache2 for more information.
See also the property *trunk* to enable experimental expressions.
*remote_ip*
This is used when you want to artificially set the remote ip
address, i.e. the address of the visitor accessing the page. This is
used essentially by the SSI directive:
my $ssi = Apache2::SSI->new( remote_ip => '192.168.2.10' ) ||
die( Apache2::SSI->error );
<!--#if expr="-R '192.168.2.0/24' || -R '127.0.0.1/24'" -->
Remote ip is part of my private network
<!--#else -->
Go away!
<!--#endif -->
*sizefmt*
The default way to format a file size. By default, this is "abbrev",
which means a human readable format such as "2.5M" for 2.5
megabytes. Other possible value is "bytes" which would have the
"fsize" ssi directive return the size in bytes.
See Apache2 documentation
<https://httpd.apache.org/docs/current/en/howto/ssi.html> for more
( run in 0.355 second using v1.01-cache-2.11-cpan-39bf76dae61 )