Apache2-SSI
view release on metacpan or search on metacpan
use Apache2::RequestUtil (); # extends Apache2::RequestRec objects
my $r = $r->is_initial_req ? $r : $r->main;
*debug*
Sets the debug level. Starting from 3, this will output on the
STDERR or in Apache error log a lot of debugging output.
*document_root*
This is only necessary to be provided if this is not running under
Apache mod_perl. Without this value, Apache2::SSI has no way to
guess the document root and will not be able to function properly
and will return an "error".
*document_uri*
This is only necessary to be provided if this is not running under
Apache mod_perl. This must be the uri of the document being served,
such as "/my/path/index.html". So, if you are using this outside of
the rim of Apache mod_perl and your file resides, for example, at
"/home/john/www/my/path/index.html" and your document root is
"/home/john/www", then the document uri would be
"/my/path/index.html"
*debug*
: Sets the debug level. Starting from 3, this will output on the
STDERR or in Apache error log a lot of debugging output.
*document\_root*
: This is only necessary to be provided if this is not running under
Apache mod\_perl. Without this value,
[Apache2::SSI](https://metacpan.org/pod/Apache2::SSI){.perl-module}
has no way to guess the document root and will not be able to
function properly and will return an
[\"error\"](#error){.perl-module}.
*document\_uri*
: This is only necessary to be provided if this is not running under
Apache mod\_perl. This must be the uri of the document being served,
such as `/my/path/index.html`. So, if you are using this outside of
the rim of Apache mod\_perl and your file resides, for example, at
`/home/john/www/my/path/index.html` and your document root is
lib/Apache2/SSI.pm view on Meta::CPAN
use Apache2::RequestUtil (); # extends Apache2::RequestRec objects
my $r = $r->is_initial_req ? $r : $r->main;
=item C<debug>
Sets the debug level. Starting from 3, this will output on the STDERR or in Apache error log a lot of debugging output.
=item C<document_root>
This is only necessary to be provided if this is not running under Apache mod_perl. Without this value, L<Apache2::SSI> has no way to guess the document root and will not be able to function properly and will return an L</error>.
=item C<document_uri>
This is only necessary to be provided if this is not running under Apache mod_perl. This must be the uri of the document being served, such as C</my/path/index.html>. So, if you are using this outside of the rim of Apache mod_perl and your file resid...
=item C<errmsg>
The error message to be returned when a ssi directive fails. By default, it is C<[an error occurred while processing this directive]>
=item C<html>
lib/Apache2/SSI/File/Type.pm view on Meta::CPAN
my $io = IO::File->new( "</somewhere/unknown/file2" );
my $mime_type = $m->handle( $io );
$io->read( $data, 0x8564 );
my $mime_type = $m->data( $data );
=head1 DESCRIPTION
This module emulates the functionnality of L<file(1)> unix utility cross platform, and returns the file MIME type.
It can guess it from a file name, data or file handle using methods described below.
It does not depend upon an external application to function.
=head1 CONSTRUCTOR
=over 4
=item B<new>( [ "/some/where/file.cgi" ] )
Creates a new L<Apache2::SSI::File::Type> object and returns it.
lib/Apache2/SSI/File/Type.pm view on Meta::CPAN
./my_script.pl 2>my_magic
=head2 error_returns_undef
Sets or gets the boolean value to decide whether this module will return a default value (see L</default_type>) or C<undef> when there is an error.
By default this is set to false, and the module will return a default value upon error.
=head2 file( '/some/file/path.txt' )
Provided with a file and this will guess its mim type.
If an error occurs, and if L</error_returns_undef> is set to true, it will return C<x-system/x-error; description>
where description is the description of the error, otherwise it will set an error object with the error string and return C<undef>. See L<Module::Generic/error> for more information about the error object.
If the file to check is not a regular file or is empty, it will call L<perlfunc/stat> and it will try hard to find its mime type.
Otherwise, it defaults to the value set with L</default_type>.
=head2 follow_links
Provided with a boolean value, this sets whether links should be followed.
Default to true.
=head2 handle
Provided with an opened file handle and this method will try to guess the mime type and returns it.
It defaults to whatever value is set with L</default_type>.
=head2 parse_magic_file
Provided with a file handle, and this will parse the magic file, and load its data into the object.
=for Pod::Coverage parse_magic_line
=for Pod::Coverage read_magic_entry
=head2 with_data
Provided with some data, and this will attempt at guessing the mime type, and return it.
=head2 with_filename
Provided with a file name, and this will attempt at guessing the mime type, and return it.
=head2 with_magic
Provided with a C<magic> value, and this will attempt at guessing the mime type, and return it.
=head1 AUTHOR
Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
=head1 CREDITS
Credits Nokubi Takatsugu.
=head1 SEE ALSO
lib/Apache2/SSI/Finfo.pm view on Meta::CPAN
=head2 is_pipe
Returns true if this is a pipe, false otherwise.
=head2 is_socket
Returns true if this is a socket, false otherwise.
=head2 mime_type
Using L<Apache2::SSI::File::Type>, this guess the file mime type and returns it.
=head2 mode
Returns the file mode. This is equivalent to the mode & 07777, ie without the file type bit.
So you could do something like:
if( $finfo->mode & 0100 )
{
print( "Owner can execute\n" );
lib/Apache2/SSI/URI.pm view on Meta::CPAN
my $uri = Apache2::SSI::URI->new(
base_uri => '/some/folder/file.html',
apache_request => $r,
document_uri => '../other.html',
# No need to specify document_root, because it will be derived from
# the Apache2::RequestRec provided with the apache_request parameter.
);
=item C<document_root>
This is only necessary to be provided if this is not running under Apache mod_perl. Without this value, L<Apache2::SSI> has no way to guess the document root and will not be able to function properly and will return an L</error>.
=item C<document_uri>
This is only necessary to be provided if this is not running under Apache mod_perl. This must be the uri of the document being served, such as C</my/path/index.html>. So, if you are using this outside of the rim of Apache mod_perl and your file resid...
=back
=head2 apache_request
Sets or gets the L<Apache2::RequestRec> object. As explained in the L</new> method, you can get this Apache object by requiring the package L<Apache2::RequestUtil> and calling L<Apache2::RequestUtil/request> such as C<Apache2::RequestUtil->request> a...
( run in 0.788 second using v1.01-cache-2.11-cpan-702932259ff )