Apache2-SSI

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

    for version 2.2 or lower and will call "useragent_ip" in
    Apache2::Connection for version above 2.2, and otherwise this will get
    the value from the environment variable "REMOTE_ADDR"

    This value can also be overriden by being provided during object
    instantiation.

        # Pretend the ssi directives are accessed from this ip
        $ssi->remote_ip( '192.168.2.20' );

    This is useful when one wants to check how the rendering will be when
    accessed from certain ip addresses.

    This is used primarily when there is an expression such as

        <!--#if expr="-R '192.168.1.0/24' -->
        Visitor is part of my private network
        <!--#endif -->

    or

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

    Apache2::Connection also has a "remote_addr" in Apache2::Connection
    method, but this returns a APR::SockAddr 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

  request_uri
    This is an alias for "document_uri"

  server_version
    Returns the server version as a version object can caches that value.

    Under mod_perl2, it uses "get_server_description" in Apache2::ServerUtil
    and outside of mod_perl, it tries to find "apxs" using File::Which 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

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" -->

  if, elif, endif and else
        <!--#if expr="$debug > 1" -->
        I will print a lot of debugging
        <!--#else -->
        Debugging output will be reasonable
        <!--#endif -->

    or with new version of Apache SSI:

        No such file or directory.
        <!--#if expr="v('HTTP_REFERER') != ''" -->
        Please let the admin of the <a href="<!--#echo encoding="url" var="HTTP_REFERER" -->"referring site</a> know about their dead link.
        <!--#endif -->

  functions
    Apache SSI supports the following functions, as of Apache version 2.4.



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