Apache2-SSI
view release on metacpan or search on metacpan
lib/Apache2/SSI/URI.pm view on Meta::CPAN
my $up = $uri->parent;
# would return /some/path assuming the document uri was /some/path/file.html
=head2 path_info
Sets or gets the path info for the current uri.
Example:
my $string = $ssi->path_info;
$ssi->path_info( '/my/path/info' );
The path info value is also set automatically when L</document_uri> is called, such as:
$ssi->document_uri( '/some/path/to/file.html/my/path/info?q=something&l=ja_JP' );
This will also set automatically the C<PATH_INFO> environment variable.
=head2 query_string
Set or gets the query string for the current uri.
Example:
my $string = $ssi->query_string;
$ssi->query_string( 'q=something&l=ja_JP' );
or, using the L<URI> module:
$ssi->query_string( $uri->query );
The query string value is set automatically when you provide an L<document_uri> upon instantiation or after:
$ssi->document_uri( '/some/path/to/file.html?q=something&l=ja_JP' );
This will also set automatically the C<QUERY_STRING> environment variable.
=head2 root
Returns an object representation of the root uri, i.e. C</>
=head2 slurp
It returns the content of the L</filename>
it takes an hash reference of parameters:
=over 4
=item C<binmode>
my $content = $uri->slurp({ binmode => ':utf-8' });
=back
It will return undef and sets an L<Module::Generic/error> if there is no L</filename> value set or if the file cannot be opened.
=head2 slurp_utf8
It returns the content of the file L</filename> utf-8 decoded.
This is equivalent to:
my $content = $uri->slurp({ binmode => ':utf8' });
C<:utf8> is slightly a bit more lax than C<:utf-8>, so it you want strict utf8, you can do:
my $content = $uri->slurp({ binmode => ':utf-8' });
=head1 AUTHOR
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
CPAN ID: jdeguest
L<https://gitlab.com/jackdeguest/Apache2-SSI>
=head1 SEE ALSO
L<Apache2::SSI::File>, L<Apache2::SSI::Finfo>, L<Apache2::SSI>
mod_include, mod_perl(3), L<APR::URI>, L<URI>
L<https://httpd.apache.org/docs/current/en/mod/mod_include.html>,
L<https://httpd.apache.org/docs/current/en/howto/ssi.html>,
L<https://httpd.apache.org/docs/current/en/expr.html>
L<https://perl.apache.org/docs/2.0/user/handlers/filters.html#C_PerlOutputFilterHandler_>
=head1 COPYRIGHT & LICENSE
Copyright (c) 2020-2021 DEGUEST Pte. Ltd.
You can use, copy, modify and redistribute this package and associated
files under the same terms as Perl itself.
=cut
( run in 0.634 second using v1.01-cache-2.11-cpan-39bf76dae61 )