Apache2-SSI

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN


See
[ExtUtils::MakeMaker](https://metacpan.org/pod/ExtUtils::MakeMaker){.perl-module}
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](https://metacpan.org/pod/Apache2::Filter){.perl-module}
    object object that is provided if running under mod\_perl.

*apache\_request*

:   This is the
    [Apache2::RequestRec](https://metacpan.org/pod/Apache2::RequestRec){.perl-module}
    object that is provided if running under mod\_perl.

    it can be retrieved from [\"request\" in
    Apache2::RequestUtil](https://metacpan.org/pod/Apache2::RequestUtil#request){.perl-module}
    or via [\"r\" in
    Apache2::Filter](https://metacpan.org/pod/Apache2::Filter#r){.perl-module}

    You can get this
    [Apache2::RequestRec](https://metacpan.org/pod/Apache2::RequestRec){.perl-module}
    object by requiring
    [Apache2::RequestUtil](https://metacpan.org/pod/Apache2::RequestUtil){.perl-module}
    and calling its class method [\"request\" in
    Apache2::RequestUtil](https://metacpan.org/pod/Apache2::RequestUtil#request){.perl-module}
    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](https://metacpan.org/pod/Apache2::RequestUtil#is_initial_req){.perl-module},
    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](https://metacpan.org/pod/Apache2::SSI){.perl-module}
    has no way to guess the document root and will not be able to
    function properly and will return an
    [\"error\"](#error){.perl-module}.

*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\"](#parse){.perl-module} 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](https://metacpan.org/pod/Regexp::Common::Apache2){.perl-module}
    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 -->



( run in 0.507 second using v1.01-cache-2.11-cpan-39bf76dae61 )