Apache2-SSI

 view release on metacpan or  search on metacpan

README.md  view on Meta::CPAN


or

        <!--#if expr="v('REMOTE_ADDR') -R '192.168.1.0/24' -->
        <!--#include file="/home/john/special_hidden_login_feature.html" -->
        <!--#endif -->

[Apache2::Connection](https://metacpan.org/pod/Apache2::Connection){.perl-module}
also has a [\"remote\_addr\" in
Apache2::Connection](https://metacpan.org/pod/Apache2::Connection#remote_addr){.perl-module}
method, but this returns a
[APR::SockAddr](https://metacpan.org/pod/APR::SockAddr){.perl-module}
object that is used to get the binary version of the ip. However you can
also get the string version like this:

        use APR::SockAddr ();
        my $ip = $r->connection->remote_addr->ip_get();

Versions above 2.2 make a distinction between ip from direct connection,
or the real ip behind a proxy, i.e. [\"useragent\_ip\" in
Apache2::Connection](https://metacpan.org/pod/Apache2::Connection#useragent_ip){.perl-module}

request\_uri
------------

This is an alias for [\"document\_uri\"](#document_uri){.perl-module}

server\_version
---------------

Returns the server version as a
[version](https://metacpan.org/pod/version){.perl-module} object can
caches that value.

Under mod\_perl2, it uses [\"get\_server\_description\" in
Apache2::ServerUtil](https://metacpan.org/pod/Apache2::ServerUtil#get_server_description){.perl-module}
and outside of mod\_perl, it tries to find `apxs` using
[File::Which](https://metacpan.org/pod/File::Which){.perl-module} and in
last resort, tries to find the `apache2` or `httpd` binary to get its
version information.

sizefmt
-------

Sets or gets the formatting for file sizes. Value can be either `bytes`
or `abbrev`

timefmt
-------

Sets or gets the formatting for date and time values. The format takes
the same values as [\"strftime\" in
POSIX](https://metacpan.org/pod/POSIX#strftime){.perl-module}

Encoding
========

At present time, the html data are treated as utf8 data and decoded and
encoded back as such.

If there is a need to broaden support for other charsets, let me know.

SSI Directives
==============

This is taken from Apache documentation and summarised here for
convenience and clarity to the perl community.

config
------

        <!--#config errmsg="Error occurred" sizefmt="abbrev" timefmt="%B %Y" -->
        <!--#config errmsg="Oopsie" -->
        <!--#config sizefmt="bytes" -->
        # Thursday 24 December 2020
        <!--#config timefmt="%A $d %B %Y" -->

echo
----

         <!--#set var="HTMl_TITLE" value="Un sujet intéressant" -->
         <!--#echo var="HTMl_TITLE" encoding="entity" -->

Encoding can be either `entity`, `url` or `none`

exec
----

        # pwd is "print working directory" in shell
        <!--#exec cmd="pwd" -->
        <!--#exec cgi="/uri/path/to/prog.cgi" -->

include
-------

        # Filesystem file path
        <!--#include file="/home/john/var/quote_of_the_day.txt" -->
        # Relative to the document root
        <!--#include virtual="/footer.html" -->

flastmod
--------

         <!--#flastmod file="/home/john/var/quote_of_the_day.txt" -->
         <!--#flastmod virtual="/copyright.html" -->

fsize
-----

        <!--#fsize file="/download/software-v1.2.tgz" -->
        <!--#fsize virtual="/images/logo.jpg" -->

printenv
--------

        <!--#printenv -->

set
---

        <!--#set var="debug" value="2" -->



( run in 3.666 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )