/usr/share/perl5/MIME/Types.pod is in libmime-types-perl 1.32-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 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | =head1 NAME
MIME::Types - Definition of MIME types
=head1 INHERITANCE
MIME::Types
is a Exporter
=head1 SYNOPSIS
use MIME::Types;
my $mimetypes = MIME::Types->new;
my MIME::Type $def = $mimetypes->type('text/plain');
my MIME::Type $def = $mimetypes->mimeTypeOf('gif');
=head1 DESCRIPTION
=head2 MIME::Types and mod_perl
This module uses a DATA handle to read all the types at first
instantiation, which doesn't play nicely with mod_perl and fork.
When you use this module with mod_perl, add this to C<startup.pl>
use MIME::Types;
BEGIN { MIME::Types->new() }
Now, the type definitions will get parsed before the processes are spawned.
=head2 MIME::Types and daemons (fork)
If your program uses fork (usually for a daemon), then the situation
is a bit like with mod_perl before: you want to have the type table
initialized before you start forking. So, first call
my $mt = MIME::Types->new;
Later, each time you create this object (you may, of course, also reuse
the object you create here) you will get access to the same global table
of types.
MIME types are used in MIME compliant lines, for instance as part
of e-mail and HTTP traffic, to indicate the type of content which is
transmitted. Sometimes real knowledge about a mime-type is need.
This module maintains a set of L<MIME::Type|MIME::Type> objects, which
each describe one known mime type. There are many types defined
by RFCs and vendors, so the list is long but not complete. Please
don't hestitate to ask to add additional information.
If you wish to get access to the C<mime.types> files, which are
available on various places in UNIX and Linux systems, then have a
look at File::TypeInfo.
=head1 METHODS
=head2 Instantiation
=over 4
=item MIME::Types-E<gt>B<new>(OPTIONS)
Create a new C<MIME::Types> object which manages the data. In the current
implementation, it does not matter whether you create this object often
within your program, but in the future this may change.
-Option --Default
only_complete <false>
=over 2
=item only_complete => BOOLEAN
Only include complete MIME type definitions: requires at least one known
extension. This will reduce the number of entries --and with that the
amount of memory consumed-- considerably.
In your program you have to decide: the first time that you call
the creator (C<new>) determines whether you get the full or the partial
information.
=back
=back
=head2 Knowledge
=over 4
=item $obj-E<gt>B<addType>(TYPE, ...)
Add one or more TYPEs to the set of known types. Each TYPE is a
C<MIME::Type> which must be experimental: either the main-type or
the sub-type must start with C<x->.
Please inform the maintainer of this module when registered types
are missing. Before version MIME::Types version 1.14, a warning
was produced when an unknown IANA type was added. This has been
removed, because some people need that to get their application
to work locally... broken applications...
=item $obj-E<gt>B<extensions>
Returns a list of all defined extensions.
=item $obj-E<gt>B<mimeTypeOf>(FILENAME)
Returns the C<MIME::Type> object which belongs to the FILENAME (or simply
its filename extension) or C<undef> if the file type is unknown. The extension
is used, and considered case-insensitive.
In some cases, more than one type is known for a certain filename extension.
In that case, one of the alternatives is chosen at random.
example: use of mimeTypeOf()
my MIME::Types $types = MIME::Types->new;
my MIME::Type $mime = $types->mimeTypeOf('gif');
my MIME::Type $mime = $types->mimeTypeOf('jpg');
print $mime->isBinary;
=item $obj-E<gt>B<type>(STRING)
Return the C<MIME::Type> which describes the type related to STRING. One
type may be described more than once. Different extensions is use for
this type, and different operating systems may cause more than one
C<MIME::Type> object to be defined. In scalar context, only the first
is returned.
=item $obj-E<gt>B<types>
Returns a list of all defined mime-types
=back
=head1 FUNCTIONS
The next functions are provided for backward compatibility with MIME::Types
versions 0.06 and below. This code originates from Jeff Okamoto
F<okamoto@corp.hp.com> and others.
=over 4
=item B<by_mediatype>(TYPE)
This function takes a media type and returns a list or anonymous array of
anonymous three-element arrays whose values are the file name suffix used to
identify it, the media type, and a content encoding.
TYPE can be a full type name (contains '/', and will be matched in full),
a partial type (which is used as regular expression) or a real regular
expression.
=item B<by_suffix>(FILENAME|SUFFIX)
Like C<mimeTypeOf>, but does not return an C<MIME::Type> object. If the file
+type is unknown, both the returned media type and encoding are empty strings.
example: use of function by_suffix()
use MIME::Types 'by_suffix';
my ($mediatype, $encoding) = by_suffix 'image.gif';
my $refdata = by_suffix 'image.gif';
my ($mediatype, $encoding) = @$refdata;
=item B<import_mime_types>
This method has been removed: mime-types are only useful if understood
by many parties. Therefore, the IANA assigns names which can be used.
In the table kept by this C<MIME::Types> module all these names, plus
the most often used termporary names are kept. When names seem to be
missing, please contact the maintainer for inclussion.
=back
=head1 SEE ALSO
This module is part of MIME-Types distribution version 1.32,
built on August 18, 2011. Website: F<http://perl.overmeer.net/mimetypes/>
=head1 LICENSE
Copyrights 1999,2001-2011 by Mark Overmeer. For other contributors see ChangeLog.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>
|