Apache2-SSI

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

SIGNATURE
t/00.load.t
t/02.pod.t
t/20.collapse-dots.t
t/30.bare.t
t/31.file.t
t/32.virtual.t
t/33.if.t
t/34.set_var.t
t/35.exec.t
t/36.escape.t
t/37.flastmod.t
t/38.fsize.t
t/39.functions.t
t/40.misc.t
t/41.ap2perl.t
t/42.expression.t
t/50.finfo.t
t/60.uri.t
t/70.file.t
t/71.file_type.t

MANIFEST  view on Meta::CPAN

t/htdocs/ssi/03.14.if.html
t/htdocs/ssi/03.15.if.html
t/htdocs/ssi/03.16.if.html
t/htdocs/ssi/04.01.set_var.html
t/htdocs/ssi/04.02.set_var.html
t/htdocs/ssi/04.03.set_var.html
t/htdocs/ssi/05.01.exec.html
t/htdocs/ssi/05.02.exec.html
t/htdocs/ssi/05.03.exec.html
t/htdocs/ssi/05.04.exec.html
t/htdocs/ssi/06.01.escape.html
t/htdocs/ssi/07.01.flastmod.html
t/htdocs/ssi/07.02.flastmod.html
t/htdocs/ssi/07.03.flastmod.html
t/htdocs/ssi/08.01.fsize.html
t/htdocs/ssi/08.02.fsize.html
t/htdocs/ssi/09.01.functions.html
t/htdocs/ssi/09.02.functions.html
t/htdocs/ssi/09.03.functions.html
t/htdocs/ssi/09.04.functions.html
t/htdocs/ssi/09.05.functions.html

README  view on Meta::CPAN


    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' );

README  view on Meta::CPAN


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

    Example:

        $ssi->encode_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.

  encode_uri
    Encode uri data. This uses "uri_escape_utf8" in URI::Escape.

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

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

    Example:

        $ssi->encode_uri( 'https://www.example.com/' );

README  view on Meta::CPAN

    Return first match of note, reqenv, and osenv

    Example:

        <!--#if expr="env( $QUERY_STRING ) == /\bl=ja_JP/" -->
        Showing Japanese data
        <!--#else -->
        Defaulting to English
        <!--#endif -->

  parse_func_escape
    Escape special characters in %hex encoding.

    Example:

        <!--#set var="website" value="https://www.example.com/" -->
        Please go to <a href="<!--#echo var='website' encoding='escape' -->"><!--#echo var="website" --></a>

  parse_func_http
    Get HTTP request header; header names may be added to the Vary header.

    Example:

        <!--#if expr="http('X-API-ID') == 1234567" -->
        You're good to go.
        <!--#endif -->

README  view on Meta::CPAN

    Decode base64 encoded string, return truncated string if 0x00 is found.

    Example:

        <!--#if expr="unbase64('VG91cyBsZXMgw6p0cmVzIGh1bWFpbnMgbmFpc3NlbnQgbGlicmVzIGV0IMOpZ2F1eCBlbiBkaWduaXTDqSBldCBlbiBkcm9pdHMu') == 'Tous les êtres humains naissent libres et égaux en dignité et en droits.'" -->
        This worked!
        <!--#else -->
        Nope, it failed.
        <!--#endif -->

  parse_func_unescape
    Unescape %hex encoded string, leaving encoded slashes alone; return
    empty string if %00 is found.

    Example:

        <!--#if expr="unescape('https%3A%2F%2Fwww.example.com%2F') == 'https://www.example.com/'" -->
        This worked!
        <!--#else -->
        Nope, it failed.
        <!--#endif -->

  parse_if
    Parse the "if" condition.

    See "parse_elif" above for example.

README  view on Meta::CPAN


    See Apache documentation
    <https://httpd.apache.org/docs/current/en/expr.html#page-header> for
    detailed description of what they do.

    You can also refer to the methods "parse_func_*" documented above, which
    implement those Apache functions.

    *base64*
    *env*
    *escape*
    *http*
    *ldap*
    *md5*
    *note*
    *osenv*
    *replace*
    *req*
    *reqenv*
    *req_novary*
    *resp*
    *sha1*
    *tolower*
    *toupper*
    *unbase64*
    *unescape*

  variables
    On top of all environment variables available, Apache makes the
    following ones also accessible:

    DATE_GMT
    DATE_LOCAL
    DOCUMENT_ARGS
    DOCUMENT_NAME
    DOCUMENT_PATH_INFO

README.md  view on Meta::CPAN

[\"error\"](#error){.perl-module} object accordingly.

Example:

        $ssi->decode_entities( 'Tous les &Atilde;&ordf;tres humains naissent libres et &Atilde;&copy;gaux en dignit&Atilde;&copy; 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](https://metacpan.org/pod/URI::Escape#uri_unescape){.perl-module}.

Not to be confused with x-www-form-urlencoded data. For that see
[\"decode\_url\"](#decode_url){.perl-module}

If an error occurred during decoding, it will return undef and set an
[\"error\"](#error){.perl-module} object accordingly.

Example:

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

README.md  view on Meta::CPAN

[\"error\"](#error){.perl-module} object accordingly.

Example:

        $ssi->encode_entities( 'Tous les êtres humains naissent libres et égaux en dignité et en droits.' );
        # Tous les &Atilde;&ordf;tres humains naissent libres et &Atilde;&copy;gaux en dignit&Atilde;&copy; et en droits.

encode\_uri
-----------

Encode uri data. This uses [\"uri\_escape\_utf8\" in
URI::Escape](https://metacpan.org/pod/URI::Escape#uri_escape_utf8){.perl-module}.

Not to be confused with x-www-form-urlencoded data. For that see
[\"encode\_url\"](#encode_url){.perl-module}

If an error occurred during encoding, it will return undef and set an
[\"error\"](#error){.perl-module} object accordingly.

Example:

        $ssi->encode_uri( 'https://www.example.com/' );

README.md  view on Meta::CPAN

[osenv](https://metacpan.org/pod/osenv){.perl-module}

Example:

        <!--#if expr="env( $QUERY_STRING ) == /\bl=ja_JP/" -->
        Showing Japanese data
        <!--#else -->
        Defaulting to English
        <!--#endif -->

parse\_func\_escape
-------------------

Escape special characters in %hex encoding.

Example:

        <!--#set var="website" value="https://www.example.com/" -->
        Please go to <a href="<!--#echo var='website' encoding='escape' -->"><!--#echo var="website" --></a>

parse\_func\_http
-----------------

Get HTTP request header; header names may be added to the Vary header.

Example:

        <!--#if expr="http('X-API-ID') == 1234567" -->
        You're good to go.

README.md  view on Meta::CPAN

Decode base64 encoded string, return truncated string if 0x00 is found.

Example:

        <!--#if expr="unbase64('VG91cyBsZXMgw6p0cmVzIGh1bWFpbnMgbmFpc3NlbnQgbGlicmVzIGV0IMOpZ2F1eCBlbiBkaWduaXTDqSBldCBlbiBkcm9pdHMu') == 'Tous les êtres humains naissent libres et égaux en dignité et en droits.'" -->
        This worked!
        <!--#else -->
        Nope, it failed.
        <!--#endif -->

parse\_func\_unescape
---------------------

Unescape %hex encoded string, leaving encoded slashes alone; return
empty string if %00 is found.

Example:

        <!--#if expr="unescape('https%3A%2F%2Fwww.example.com%2F') == 'https://www.example.com/'" -->
        This worked!
        <!--#else -->
        Nope, it failed.
        <!--#endif -->

parse\_if
---------

Parse the `if` condition.

README.md  view on Meta::CPAN

implement those Apache functions.

*base64*

:   

*env*

:   

*escape*

:   

*http*

:   

*ldap*

:   

README.md  view on Meta::CPAN

:   

*toupper*

:   

*unbase64*

:   

*unescape*

:   

variables
---------

On top of all environment variables available, Apache makes the
following ones also accessible:

DATE\_GMT

SIGNATURE  view on Meta::CPAN

SHA256 841ea2c6c09226881822d1d0e99764181983fe073f8e15f6c9d3b40a259d503e scripts/startup.pl
SHA256 c25e83d5bc3da4b519e35ddd25212e2f1c852f18d666e9819cce04906bebeeb7 t/00.load.t
SHA256 6f1861e831ddadad06bd2051dbc6fca476e0c0697b46dabe57f247df4629f98d t/02.pod.t
SHA256 e49479972b9574306d63dfda5e736aecf5c37ba28d50ab6acf4fd3c250a36062 t/20.collapse-dots.t
SHA256 fa61b6d2f88781079ed257626dfbf0b9ae4c12fc3462c055fa9dd4c4dc681b7f t/30.bare.t
SHA256 da21909259c74c00be9d8fe2efaada3590aabc58d09b2423977441477a6d601f t/31.file.t
SHA256 7ebb7567348603885426d6180a88d8cfeb581476debfcf7d673867990422825f t/32.virtual.t
SHA256 48b2761a05cba07d3717b107abcbddd2a8cb52a22655ef98aefdb7d0da248de7 t/33.if.t
SHA256 4dd1af9c338539008cef7b5e63ba1fa00077692cc43b0e3c4c1c82f383c88792 t/34.set_var.t
SHA256 8ff1ff97a5fa89c178c0aee3542df8fb49f38085cfeeb4e78327f15099e08e75 t/35.exec.t
SHA256 188511c70f570cb1f6716016c0a5ead410e111e5532802462b537a0893f6eba4 t/36.escape.t
SHA256 7e42143e9f5194ce7c6cd067d1280540e7f1272f54683dca42f11c98c108ddff t/37.flastmod.t
SHA256 93759a6d231186e70482fd0fa97051e6f653928a111965af10989ea62fff3435 t/38.fsize.t
SHA256 01e49da5fa09fe5b5aa3e67db370a702d67fd232fc29c0746580a5f00f08506c t/39.functions.t
SHA256 692e27c76a103082685765bdbb7e9b2f77a3f7843948de332f8dfd29f4b46102 t/40.misc.t
SHA256 2934636ad93f93304171731cd54e3fb8115d46ab83c3715a988bf0ff9052d30d t/41.ap2perl.t
SHA256 08d207f8042493f22310d28d351b07683a3e03876c5929fab867447091d84f27 t/42.expression.t
SHA256 8574f5f68b9824b5b6241bf713d50b2a4b1a8c0980c9bbb5e0c6221963e8c52c t/50.finfo.t
SHA256 3235a17ec6fb6c22e363cb3f66ed5562e391e3704b4f916db6b00c16eb82eb82 t/60.uri.t
SHA256 b34fe4df7f0e4a8816e2e3f6abfc590bc421085b8e4182665c1e6db403db2851 t/70.file.t
SHA256 2b824d7b6a057223d8b2059a89356b47b5e5431e1eb613f863f86dbd8cc79045 t/71.file_type.t

SIGNATURE  view on Meta::CPAN

SHA256 cabef67ff41efe10700fdddc9601aa0bb120850a6bd62db27122100d3f80235e t/htdocs/ssi/03.14.if.html
SHA256 7dfae00544f5c937d08b3c1ac0aeba08ac08c30db30c20173accc87335685540 t/htdocs/ssi/03.15.if.html
SHA256 7a618688b064018b0ebd62849f4bb07585c5190eec51bb0355174d66d94f9006 t/htdocs/ssi/03.16.if.html
SHA256 b9d5af6536155ff878257b024af6c77790b8ae7da03261577533e206bf6b0d14 t/htdocs/ssi/04.01.set_var.html
SHA256 31ae70a7dde68487a81c39e9e45c668b2c7e7a6d77f3de99fbbf2c887c2ee2d1 t/htdocs/ssi/04.02.set_var.html
SHA256 923345caf2b8e3637635439a3da4a4d0c8e252f410f0f7b90c225da4ad5507a4 t/htdocs/ssi/04.03.set_var.html
SHA256 5c090408082bfd28c2bbc044c7d9713d113b5fd192cedee4d96b86dbc3ffd12f t/htdocs/ssi/05.01.exec.html
SHA256 0212f7535b467bbdaab503e2605291c955758590307839a95f048ccd2ef5287f t/htdocs/ssi/05.02.exec.html
SHA256 393ec77dfa6785a383b7350baaf0d379395b56c9be4e7ea49676164c60cfc44f t/htdocs/ssi/05.03.exec.html
SHA256 794f71908f089dccfa7fbd3857f3cc8d39e243e85bf12e58c43759b51fd2e8a4 t/htdocs/ssi/05.04.exec.html
SHA256 38c62963ab7e95c0633699e428dad52f0117ed73e514a4ca3f9c13bbb7bc9010 t/htdocs/ssi/06.01.escape.html
SHA256 1d4ed372eba1f513cea7e929d24146c45f8ec8f184d2a4bdb2bf7223f9ea5b4d t/htdocs/ssi/07.01.flastmod.html
SHA256 a00267a1aea9a3062970a6da244652d6283c53f26cc7b616f1c87417e1d2f54a t/htdocs/ssi/07.02.flastmod.html
SHA256 3f78f314139a82f078358210c489913af093a919f160215d3abca33a9deda02a t/htdocs/ssi/07.03.flastmod.html
SHA256 0c4f521d648849ddc70aa756ede4d0dd71896974e69641da0d3d39e928468ec3 t/htdocs/ssi/08.01.fsize.html
SHA256 1e3fe9bb9ca522532f26176287c16f891e35ce1206c5eb6a282d9d593ff66a77 t/htdocs/ssi/08.02.fsize.html
SHA256 3e747a1a8019232ec88cb227e49300047531b79d398234da58fa88950d67f4a2 t/htdocs/ssi/09.01.functions.html
SHA256 86c2b40cab6dd239217c100f2a4864413e2b818bb8c58e971537b0b8f0bb0611 t/htdocs/ssi/09.02.functions.html
SHA256 2a3abe7a3f889ae47efc69177aca0b96f4312b978422f76e3e740ea1490eacfa t/htdocs/ssi/09.03.functions.html
SHA256 8b80309bbfdc25500e99a011a284b8734441f52bbabfa00e39ce4aa4972045cf t/htdocs/ssi/09.04.functions.html
SHA256 3c8f5a4c79a075199d5769459eebe5a6f10c871c290dcefe25dc2c222f0de3e2 t/htdocs/ssi/09.05.functions.html

lib/Apache2/SSI.pm  view on Meta::CPAN

                        |
                        (?<attr_val>(?>\\'|[^'])*+)
                    )
                    \g{quote}
                    [[:blank:]\h]*
                )
            )
        )
    /xsmi;
    
    our $SUPPORTED_FUNCTIONS = qr/(base64|env|escape|http|ldap|md5|note|osenv|replace|req|reqenv|req_novary|resp|sha1|tolower|toupper|unbase64|unescape)/i;
    our $FUNCTION_PARAMETERS_RE = qr/
        [[:blank:]\h]*                                                  # Some possible leading blanks
        (?:
            (?:
                (?<func_quote>(?<func_quote_2>\")|(?<func_quote_1>\'))  # quotes used to enclose function parameters
                (?(<func_quote_2>)
                    (?<func_params>(?>\\"|[^"])*+)
                    |
                    (?<func_params>(?>\\'|[^'])*+)
                )

lib/Apache2/SSI.pm  view on Meta::CPAN

}

sub decode_uri
{
    my $self = shift( @_ );
    local $@;
    # try-catch
    my $rv = eval
    {
        require URI::Escape::XS;
        return( URI::Escape::XS::uri_unescape( @_ ) );
    };
    if( $@ )
    {
        return( $self->error( "Error while decoding uri: $@" ) );
    }
    return( $rv );
}

sub decode_url
{

lib/Apache2/SSI.pm  view on Meta::CPAN

}

sub encode_uri
{
    my $self = shift( @_ );
    local $@;
    # try-catch
    my $rv = eval
    {
        require URI::Escape::XS;
        # return( URI::Escape::uri_escape_utf8( join( '', @_ ) ) );
        return( URI::Escape::XS::uri_escape( join( '', @_ ) ) );
    };
    if( $@ )
    {
        return( $self->error( "Error while encoding uri: $@" ) );
    }
    return( $rv );
}

sub encode_url
{

lib/Apache2/SSI.pm  view on Meta::CPAN

    }
    else
    {
        $self->error( "Unrecognized size format '$self->{sizefmt}'" );
        return( $self->errmsg );
    }
}

# Functions
# See https://httpd.apache.org/docs/trunk/en/expr.html#page-header
# base64|env|escape|http|ldap|md5|note|osenv|replace|req|reqenv|req_novary|resp|sha1|tolower|toupper|unbase64|unescape
sub parse_func_base64 { return( shift->encode_base64( join( '', @_ ) ) ); }

# Return first match of note, reqenv, osenv
sub parse_func_env
{
    my $self = shift( @_ );
    my $var  = shift( @_ );
    my $r = $self->apache_request;
    my $env = $self->env;
    if( $r )

lib/Apache2/SSI.pm  view on Meta::CPAN

            return( $self->error( "An error occurred trying to get the environment value for variable \"${var}\": $@" ) );
        }
        return( $rv );
    }
    else
    {
        return( $env->{ $var } || $self->notes( $var ) );
    }
}

sub parse_func_escape { return( shift->encode_uri( join( '', @_ ) ) ); }

sub parse_func_http
{
    my $self = shift( @_ );
    my $header_name  = shift( @_ );
    my $r = $self->apache_request;
    if( $r )
    {
        my $headers = $r->headers_in;
        return( $headers->{ $header_name } );

lib/Apache2/SSI.pm  view on Meta::CPAN

}

sub parse_func_toupper
{
    my $self = shift( @_ );
    return( uc( join( '', @_ ) ) );
}

sub parse_func_unbase64 { return( shift->decode_base64( join( '', @_ ) ) ); }

sub parse_func_unescape { return( shift->decode_uri( join( '', @_ ) ) ); }

sub parse_if
{
    my( $self, $args ) = @_;
    unshift( @{$self->{if_state}}, 0 );
    unshift( @{$self->{suspend}}, $self->{suspend}->[0] );
    return( '' ) if( $self->{suspend}->[0] );
    return( $self->_handle_ifs( $self->parse_eval_expr( $args->{expr} ) ) );
}

lib/Apache2/SSI.pm  view on Meta::CPAN


If an error occurred during decoding, it will return undef and set an L</error> object accordingly.

Example:

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

=head2 decode_uri

Decode uri encoded data. This uses L<URI::Escape/uri_unescape>.

Not to be confused with x-www-form-urlencoded data. For that see L</decode_url>

If an error occurred during decoding, it will return undef and set an L</error> object accordingly.

Example:

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

lib/Apache2/SSI.pm  view on Meta::CPAN


    $ssi->encode_entities( 'Tous les êtres humains naissent libres et égaux en dignité et en droits.' );
    # Tous les &Atilde;&ordf;tres humains naissent libres et &Atilde;&copy;gaux en dignit&Atilde;&copy; et en droits.

=head2 encode_md5

Encode data provided into md5. This uses L<Digest::MD5> which it will attempt to load.

=head2 encode_uri

Encode uri data. This uses L<URI::Escape::XS/uri_escape>.

Not to be confused with x-www-form-urlencoded data. For that see L</encode_url>

If an error occurred during encoding, it will return undef and set an L</error> object accordingly.

Example:

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

lib/Apache2/SSI.pm  view on Meta::CPAN

Return first match of L<note>, L<reqenv>, and L<osenv>

Example:

    <!--#if expr="env( $QUERY_STRING ) == /\bl=ja_JP/" -->
    Showing Japanese data
    <!--#else -->
    Defaulting to English
    <!--#endif -->

=head2 parse_func_escape

Escape special characters in %hex encoding.

Example:

    <!--#set var="website" value="https://www.example.com/" -->
    Please go to <a href="<!--#echo var='website' encoding='escape' -->"><!--#echo var="website" --></a>

=head2 parse_func_http

Get HTTP request header; header names may be added to the Vary header.

Example:

    <!--#if expr="http('X-API-ID') == 1234567" -->
    You're good to go.
    <!--#endif -->

lib/Apache2/SSI.pm  view on Meta::CPAN

Decode base64 encoded string, return truncated string if 0x00 is found.

Example:

    <!--#if expr="unbase64('VG91cyBsZXMgw6p0cmVzIGh1bWFpbnMgbmFpc3NlbnQgbGlicmVzIGV0IMOpZ2F1eCBlbiBkaWduaXTDqSBldCBlbiBkcm9pdHMu') == 'Tous les êtres humains naissent libres et égaux en dignité et en droits.'" -->
    This worked!
    <!--#else -->
    Nope, it failed.
    <!--#endif -->

=head2 parse_func_unescape

Unescape %hex encoded string, leaving encoded slashes alone; return empty string if %00 is found.

Example:

    <!--#if expr="unescape('https%3A%2F%2Fwww.example.com%2F') == 'https://www.example.com/'" -->
    This worked!
    <!--#else -->
    Nope, it failed.
    <!--#endif -->

=head2 parse_if

Parse the C<if> condition.

See L</parse_elif> above for example.

lib/Apache2/SSI.pm  view on Meta::CPAN

See L<Apache documentation|https://httpd.apache.org/docs/current/en/expr.html#page-header> for detailed description of what they do.

You can also refer to the methods C<parse_func_*> documented above, which implement those Apache functions.

=over 4

=item C<base64>

=item C<env>

=item C<escape>

=item C<http>

=item C<ldap>

=item C<md5>

=item C<note>

=item C<osenv>

lib/Apache2/SSI.pm  view on Meta::CPAN

=item C<resp>

=item C<sha1>

=item C<tolower>

=item C<toupper>

=item C<unbase64>

=item C<unescape>

=back

=head2 variables

On top of all environment variables available, Apache makes the following ones also accessible:

=over 4

=item DATE_GMT

lib/Apache2/SSI/File/Type.pm  view on Meta::CPAN

        'belong'    => [ [ 'N', 'I', 'i' ], 4 ],
        'bedate'    => [   'N',             4 ],
        'uleshort'  => [   'v',             2 ],
        'leshort'   => [ [ 'v', 'S', 's' ], 2 ],
        'ulelong'   => [   'V',             4 ],
        'lelong'    => [ [ 'V', 'I', 'i' ], 4 ],
        'ledate'    => [   'V',             4 ],
        'string'    => undef(),
    };
    
    # For letter escapes in magic file
    our $ESC = 
    {
        'n' => "\n",
        'r' => "\r",
        'b' => "\b",
        't' => "\t",
        'f' => "\f"
    };
    # Cache
    our $MAGIC_DATA = [];

lib/Apache2/SSI/File/Type.pm  view on Meta::CPAN

# [ offset, bytes, type, mask, operator, testval, template, sprintf, subtests ]
#     0      1      2       3        4         5        6        7      8
#
# subtests is an array like @$data.
sub parse_magic_line 
{
    my $self = shift( @_ );
    my( $line, $line_num, $subtests ) = @_;
    my( $offtype, $offset, $numbytes, $type, $mask, $operator, $testval, $template, $message );
    
    # This would be easier if escaped whitespace wasn't allowed.
    
    # Grab the offset and type.  offset can either be a decimal, oct, or hex offset or 
    # an indirect offset specified in parenthesis like (x[.[bsl]][+-][y]), or a relative 
    # offset specified by &. offtype : 0 = absolute, 1 = indirect, 2 = relative
    if( $line =~ s/^>*([&\(]?[a-flsx\.\+\-\d]+\)?)[[:blank:]\h]+(\S+)[[:blank:]\h]+// ) 
    {
        ( $offset, $type ) = ( $1, $2 );
        if( $offset =~ /^\(/ ) 
        {
            # Indirect offset.

lib/Apache2/SSI/File/Type.pm  view on Meta::CPAN

        # Convert if needed
        $mask = oct( $mask ) if( $mask =~ /^0/o );
    }
    
    # Check if type is valid
    if( !exists( $TEMPLATES->{ $type } ) ) 
    {
        return( $self->error( "Invalid type '$type' at line $line_num" ) );
    }
    
    # Take everything after the first non-escaped space
    if( $line =~ s/([^\\])\s+(.*)/$1/ ) 
    {
        $message = $2;
    }
    else 
    {
        return( $self->error( "Missing or invalid test condition/message at line $line_num" ) );
    }
    
    # Remove the return if it is still there

lib/Apache2/SSI/File/Type.pm  view on Meta::CPAN

        $operator = '=';
    }
    
    if( $type eq 'string' ) 
    {
        $testval = $line;
    
        # Do octal/hex conversion
        $testval =~ s/\\([x0-7][0-7]?[0-7]?)/chr( oct( $1 ) )/eg;
    
        # Do single char escapes
        $testval =~ s/\\(.)/$ESC->{ $1 }||$1/eg;
    
        # Put the number of bytes to read in numbytes.
        # '0' means read to \0 or \n.
        if( $operator =~ /[>x]/o ) 
        {
            $numbytes = 0;
        }
        elsif( $operator =~ /[=<]/o ) 
        {

t/36.escape.t  view on Meta::CPAN

    our $DEBUG = exists( $ENV{AUTHOR_TESTING} ) ? $ENV{AUTHOR_TESTING} : 0;
};

use strict;
use warnings;

my $tests =
[
    {
        expect => qr/^[[:blank:]\h\v]*value\: the "value"/,
        name => 'setting variable with escaped quotes',
        uri => "${BASE_URI}/06.01.escape.html",
        code => 200,
    },
];

run_tests( $tests,
{
    debug => 0,
    type => 'escape',
});

t/39.functions.t  view on Meta::CPAN

        code => 200,
    },
    {
        expect => qr/^[[:blank:]\h\v]*This worked\!/,
        name => 'env',
        uri => "${BASE_URI}/09.02.functions.html?q=hello&l=ja-JP",
        code => 200,
    },
    {
        expect => qr/^[[:blank:]\h\v]*This worked\!/,
        name => 'escape',
        uri => "${BASE_URI}/09.03.functions.html",
        code => 200,
    },
    {
        expect => qr/^[[:blank:]\h\v]*This worked\!/,
        name => 'http',
        requires => 'mod_perl',
        uri => "${BASE_URI}/09.04.functions.html",
        code => 200,
    },

t/39.functions.t  view on Meta::CPAN

        code => 200,
    },
    {
        expect => qr/^[[:blank:]\h\v]*This worked\!/,
        name => 'unbase64',
        uri => "${BASE_URI}/09.15.functions.html",
        code => 200,
    },
    {
        expect => qr/^[[:blank:]\h\v]*This worked\!/,
        name => 'unescape',
        uri => "${BASE_URI}/09.16.functions.html",
        code => 200,
    },
];

run_tests( $tests,
{
    debug => $DEBUG,
    type => 'functions',
});

t/htdocs/ssi/09.03.functions.html  view on Meta::CPAN

<!--#if expr="escape('https://www.example.com/') == 'https%3A%2F%2Fwww.example.com%2F'" -->
This worked!
<!--#else -->
Nope, it failed.
<!--#endif -->

t/htdocs/ssi/09.16.functions.html  view on Meta::CPAN

<!--#if expr="unescape('https%3A%2F%2Fwww.example.com%2F') == 'https://www.example.com/'" -->
This worked!
<!--#else -->
Nope, it failed.
<!--#endif -->



( run in 0.740 second using v1.01-cache-2.11-cpan-c21f80fb71c )