Apache2-SSI

 view release on metacpan or  search on metacpan

README  view on Meta::CPAN

        expressions.

  handler
    This is a key method expected by mod_perl. Depending on how this module
    is used, it will redirect either to "apache_filter_handler" or to
    "apache_response_handler"

  ap2perl_expr
    This method is used to convert Apache2 expressions into perl equivalents
    to be then eval'ed.

    It takes an hash reference provided by "parse" in Apache2::Expression,
    an array reference to store the output recursively and an optional hash
    reference of parameters.

    It parse recursively the structure provided in the hash reference to
    provide the perl equivalent for each Apache2 expression component.

    It returns the array reference provided used as the content buffer. This
    array is used by "parse_expr" and then joined using a single space to
    form a string of perl expression to be eval'ed.

  apache_filter
    Set or get the Apache2::Filter object.

    When running under Apache mod_perl this is set automatically from the
    special "handler" method.

  apache_filter_handler
    This method is called from "handler" to handle the Apache response when
    this module Apache2::SSI is used as a filter handler.

    See also "apache_response_handler"

  apache_request
    Sets or gets the Apache2::RequestRec object. As explained in the "new"
    method, you can get this Apache object by requiring the package
    Apache2::RequestUtil and calling "request" in Apache2::RequestUtil such
    as "Apache2::RequestUtil-"request> assuming you have set "PerlOptions
    +GlobalRequest" in your Apache Virtual Host configuration.

    When running under Apache mod_perl this is set automatically from the
    special "handler" method, such as:

        my $r = $f->r; # $f is the Apache2::Filter object provided by Apache

  apache_response_handler
    This method is called from "handler" to handle the Apache response when
    this module Apache2::SSI is used as a response handler.

    See also "apache_filter_handler"

  clone
    Create a clone of the object and return it.

  decode_base64
    Decode base64 data provided. When running under Apache mod_perl, this
    uses "decode" in APR::Base64 module, otherwise it uses "decode" in
    MIME::Base64

    If the decoded data contain utf8 data, this will decoded the utf8 data
    using "decode" in Encode

    If an error occurred during decoding, it will return undef and set an
    "error" object accordingly.

  decode_entities
    Decode html data containing entities. This uses "decode_entities" in
    HTML::Entities

    If an error occurred during decoding, it will return undef and set an
    "error" object accordingly.

    Example:

        $ssi->decode_entities( 'Tous les êtres humains naissent libres et égaux en dignité et en droits.' );
        # Tous les êtres humains naissent libres et égaux en dignité et en droits.

  decode_uri
    Decode uri encoded data. This uses "uri_unescape" in URI::Escape.

    Not to be confused with x-www-form-urlencoded data. For that see
    "decode_url"

    If an error occurred during decoding, it will return undef and set an
    "error" object accordingly.

    Example:

        $ssi->decode_uri( 'https%3A%2F%2Fwww.example.com%2F' );
        # https://www.example.com/

  decode_url
    Decode x-www-form-urlencoded encoded data. When using Apache mod_perl,
    this uses "decode" in APR::Request and "decode" in Encode, otherwise it
    uses "url_decode_utf8" in URL::Encode (its XS version) to achieve the
    same result.

    If an error occurred during decoding, it will return undef and set an
    "error" object accordingly.

    Example:

        $ssi->decode_url( 'Tous+les+%C3%83%C2%AAtres+humains+naissent+libres+et+%C3%83%C2%A9gaux+en+dignit%C3%83%C2%A9+et+en+droits.' );
        # Tous les êtres humains naissent libres et égaux en dignité et en droits.

  document_filename
    This is an alias for "filename" in Apache2::SSI::URI

  document_directory
    Returns an Apache2::SSI::URI object of the current directory of the
    "document_uri" provided.

  document_path
    Sets or gets the uri path to the document. This is the same as
    "document_uri", except it is striped from "query_string" and
    "path_info".

  document_root
    Sets or gets the document root.

README  view on Meta::CPAN

    Sets or gets the remote ip address of the visitor.

    Under Apache mod_perl, this will call "remote_ip" in Apache2::Connection
    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 -->



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