/usr/share/perl5/MojoX/MIME/Types.pm is in libmime-types-perl 2.14-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | # Copyrights 1999,2001-2017 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.02.
package MojoX::MIME::Types;
use vars '$VERSION';
$VERSION = '2.14';
use Mojo::Base -base;
use MIME::Types ();
sub new(%)
{ # base new() constructor incorrect: should call init()
my $self = shift->SUPER::new(@_);
$self->{MMT_mt} = delete $self->{mime_types} || MIME::Types->new;
$self;
}
#----------
sub mimeTypes() { shift->{MMT_mt} }
sub types(;$)
{ my $self = shift;
return $self->{MMT_ext} if $self->{MMT_ext};
my %exttable;
my $t = MIME::Types->_MojoExtTable;
while(my ($ext, $type) = each %$t) { $exttable{$ext} = [$type] }
$self->{MMT_ext} = \%exttable;
}
#----------
sub detect($$;$)
{ my ($self, $accept, $prio) = @_;
my $mt = $self->mimeTypes;
my @ext = map $_->extensions, grep defined, map $mt->type($_),
grep !/\*/, $mt->httpAccept($accept);
\@ext;
}
sub type($;$)
{ my ($self, $ext, $types) = @_;
my $mt = $self->mimeTypes;
defined $types
or return $mt->mimeTypeOf($ext);
# stupid interface compatibility!
$self;
}
#---------------
1;
|