Apache2-SSI

 view release on metacpan or  search on metacpan

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

    exit;
    
    # on the command line:
    ./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

L<file(1)>

L<Apache2::SSI>, L<Apache2::SSI::File>, L<Apache2::SSI::Finfo>, L<Apache2::SSI::URI>

=head1 COPYRIGHT & LICENSE

Copyright (c) 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 1.170 second using v1.01-cache-2.11-cpan-39bf76dae61 )