$o = Media::Type::Simple->new;
Creates a new object. You may optionally give it a filehandle of a file with system Media information, e.g.
$o->add_types_from_file( $filehandle );
Imports types from a file. Called by new when a filehandle is specified.
Note that a true value does not necessarily indicate that the type has file extensions associated with it.
@alts = alt_types("image/jpeg"); @alts = $o->alt_types("image/jpeg");
Returns alternative or related Media types that are defined in the system For instance,
returns the list
$ext = ext_from_type( $type ); @exts = ext_from_type( $type ); $ext = $o->ext_from_type( $type ); @exts = $o->ext_from_type( $type );
Returns the file extension(s) associated with the given Media type. When called in a scalar context, returns the first extension from the list.
The order of extensions is based on the order that they occur in the source data (either the default here, or the order added using add_types_from_file or calls to add_type).
|ext3_from_type||Like ext_from_type, but only returns file extensions under three characters long.|
$type = type_from_ext( $extension ); @types = type_from_ext( $extension ); $type = $o->type_from_ext( $extension ); @types = $o->type_from_ext( $extension );
Returns the Media type(s) associated with the extension. When called in a scalar context, returns the first type from the list.
The order of types is based on the order that they occur in the source data (either the default here, or the order added using add_types_from_file or calls to add_type).
$o->add_type( $type, @extensions );
Add a type to the system, with an optional list of extensions.
$c = $o->clone;
Returns a clone of a Media::Type::Simple object. This allows you to add new types via add_types_from_file or add_type without affecting the original.
This can only be used in the object-oriented interface.
For a detailed history see the Changes file included in this distribution.
The MIME::Types module has a similar functionality, but with a more complex interface.
An official list of Media Types can be found at <http://www.iana.org/assignments/media-types>.
Robert Rothenberg <rrwo at cpan.org>
Feedback is always welcome. Please use the CPAN Request Tracker at <http://rt.cpan.org> to submit bug reports.
Some of the code comes from self module (by Kang-min Liu). The data for the media types is based on the Debian mime-support package, <http://packages.debian.org/mime-support>, although with many changes from the original.
Copyright 2009 Robert Rothenberg, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
|perl v5.20.3||MEDIA::TYPE::SIMPLE (3)||2009-01-26|