Christopher J. Madsen > Media-LibMTP-API-0.03 > Media::LibMTP::API::Filetypes

Download:
Media-LibMTP-API-0.03.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source   Latest Release: Media-LibMTP-API-0.04

NAME ^

Media::LibMTP::API::Filetypes - Map extensions & MIME types to libmtp filetypes

VERSION ^

This document describes version 0.01 of Media::LibMTP::API::Filetypes, released July 4, 2012 as part of Media-LibMTP-API version 0.03.

SYNOPSIS ^

  use Media::LibMTP::API::Filetypes qw(filetype filetype_from_path);

  $type = filetype('wav');       # File extension (sans '.')
  $type = filetype('audio/ogg'); # Internet media type
  $type = filetype_from_path('/tmp/song.mp3');

DESCRIPTION ^

Media::LibMTP::API::Filetypes provides two functions to map Internet media types and/or file extensions to the filetype constants defined by libmtp (LIBMTP_FILETYPE_*).

SUBROUTINES ^

The following functions are exported only by request:

filetype

  $type = filetype($media_type_or_extension);

This takes a filename extension (without the .) or an Internet media type (e.g. audio/ogg) and returns the corresponding libmtp filetype constant. If $media_type_or_extension is not recognized, then it returns LIBMTP_FILETYPE_UNKNOWN.

filetype_from_path

  $type = filetype_from_path($filename);

This takes a filename (with or without directory names) and returns the corresponding libmtp filetype constant (based on the filename's extension only). The file need not exist on disk. If the filename's extension is not recognized (or it has no extension at all), then it returns LIBMTP_FILETYPE_UNKNOWN.

CONFIGURATION AND ENVIRONMENT ^

Media::LibMTP::API::Filetypes requires no configuration files or environment variables.

INCOMPATIBILITIES ^

None reported.

BUGS AND LIMITATIONS ^

No bugs have been reported.

AUTHOR ^

Christopher J. Madsen <perl AT cjmweb.net>

Please report any bugs or feature requests to <bug-Media-LibMTP-API AT rt.cpan.org> or through the web interface at http://rt.cpan.org/Public/Bug/Report.html?Queue=Media-LibMTP-API.

You can follow or contribute to Media-LibMTP-API's development at http://github.com/madsen/media-libmtp-api.

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2012 by Christopher J. Madsen.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTY ^

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

syntax highlighting: