NAME
MIME::Detect::Type - the type of a file
SYNOPSIS
my $type = $mime->mime_type('/usr/bin/perl');
print $type->mime_type;
print $type->comment;
METHODS
$type->aliases
Reference to the aliases of this type
$type->comment
Array reference of the type description in various languages (currently unused)
$type->mime_type
print "Content-Type: " . $type->mime_type . "\r\n";
String of the content type
$type->globs
print $_ for @{ $type->globs };
Arrayref of the wildcard globs of this type
$type->extension
print $type->extension; # pl
Returns the default extension for this mime type, without a separating dot or the glob.
$type->valid_extension( $fn )
print "$fn has the wrong extension"
unless $type->valid_extension( $fn );
Returns whether $fn
matches one of the extensions as specified in globs
. If there is a match, the extension is returned without dot.
$type->priority
print $type->priority;
Priority of this type. Types with higher priority get tried first when trying to recognize a file type.
The default priority is 50.
$type->superclass
my $sc = $type->superclass;
print $sc->mime_type;
The notional superclass of this file type. Note that superclasses don't necessarily match the same magic numbers.
$type->matches $buffer
my $buf = "PK\003\004"; # first four bytes of file
if( $type->matches( $buf ) {
print "Looks like a " . $type->mime_type . " file";
};
REPOSITORY
The public repository of this module is http://github.com/Corion/mime-detect.
SUPPORT
The public support forum of this module is https://perlmonks.org/.
BUG TRACKER
Please report bugs in this module via the RT CPAN bug queue at https://rt.cpan.org/Public/Dist/Display.html?Name=MIME-Detect or via mail to mime-detect-Bugs@rt.cpan.org.
AUTHOR
Max Maischein corion@cpan.org
COPYRIGHT (c)
Copyright 2015-2024 by Max Maischein corion@cpan.org
.
LICENSE
This module is released under the same terms as Perl itself.