Acme-CPANModules-MIMETypes
view release on metacpan or search on metacpan
$ext = ext_from_type("image/jpeg"); # => "jpeg"
@exts = ext_from_type("image/jpeg"); # => ("jpeg", "jpg", "jpe", "jfif")
2. Finding out the MIME type associated with a certain filename
extension
2a. With MIME::Types:
use MIME::Types;
my $mt = MIME::Types->new->mimeTypeOf("gif") or die "Unknown MIME type";
say "$mt" ;# => "image/gif"
2b. With Media::Type::Simple:
use Media::Type::Simple;
$type = type_from_ext("jpg"); # => "image/jpeg"
2c. With MIME::Type::FileName (comes with its own type database, last
updated 2012):
use MIME::Type::FileName;
% cpanm-cpanmodules -n MIMETypes
Alternatively you can use the cpanmodules CLI (from App::cpanmodules
distribution):
% cpanmodules ls-entries MIMETypes | cpanm -n
or Acme::CM::Get:
% perl -MAcme::CM::Get=MIMETypes -E'say $_->{module} for @{ $LIST->{entries} }' | cpanm -n
or directly:
% perl -MAcme::CPANModules::MIMETypes -E'say $_->{module} for @{ $Acme::CPANModules::MIMETypes::LIST->{entries} }' | cpanm -n
This Acme::CPANModules module also helps lcpan produce a more meaningful
result for "lcpan related-mods" command when it comes to finding related
modules for the modules listed in this Acme::CPANModules module. See
App::lcpan::Cmd::related_mods for more details on how "related modules"
are found.
HOMEPAGE
Please visit the project's homepage at
<https://metacpan.org/release/Acme-CPANModules-MIMETypes>.
lib/Acme/CPANModules/MIMETypes.pm view on Meta::CPAN
use Media::Type::Simple;
$ext = ext_from_type("image/jpeg"); # => "jpeg"
@exts = ext_from_type("image/jpeg"); # => ("jpeg", "jpg", "jpe", "jfif")
**2. Finding out the MIME type associated with a certain filename extension**
**2a. With MIME::Types:**
use MIME::Types;
my $mt = MIME::Types->new->mimeTypeOf("gif") or die "Unknown MIME type";
say "$mt" ;# => "image/gif"
**2b. With Media::Type::Simple:**
use Media::Type::Simple;
$type = type_from_ext("jpg"); # => "image/jpeg"
**2c. With <pm:MIME::Type::FileName> (comes with its own type database, last updated 2012):**
use MIME::Type::FileName;
my $mimetype = MIME::Type::FileName::guess ("my-file.xls") or die "Unknown MIME type";
lib/Acme/CPANModules/MIMETypes.pm view on Meta::CPAN
use Media::Type::Simple;
$ext = ext_from_type("image/jpeg"); # => "jpeg"
@exts = ext_from_type("image/jpeg"); # => ("jpeg", "jpg", "jpe", "jfif")
B<2. Finding out the MIME type associated with a certain filename extension>
B<2a. With MIME::Types:>
use MIME::Types;
my $mt = MIME::Types->new->mimeTypeOf("gif") or die "Unknown MIME type";
say "$mt" ;# => "image/gif"
B<2b. With Media::Type::Simple:>
use Media::Type::Simple;
$type = type_from_ext("jpg"); # => "image/jpeg"
B<< 2c. With L<MIME::Type::FileName> (comes with its own type database, last updated 2012): >>
use MIME::Type::FileName;
my $mimetype = MIME::Type::FileName::guess ("my-file.xls") or die "Unknown MIME type";
lib/Acme/CPANModules/MIMETypes.pm view on Meta::CPAN
% cpanm-cpanmodules -n MIMETypes
Alternatively you can use the L<cpanmodules> CLI (from L<App::cpanmodules>
distribution):
% cpanmodules ls-entries MIMETypes | cpanm -n
or L<Acme::CM::Get>:
% perl -MAcme::CM::Get=MIMETypes -E'say $_->{module} for @{ $LIST->{entries} }' | cpanm -n
or directly:
% perl -MAcme::CPANModules::MIMETypes -E'say $_->{module} for @{ $Acme::CPANModules::MIMETypes::LIST->{entries} }' | cpanm -n
This Acme::CPANModules module also helps L<lcpan> produce a more meaningful
result for C<lcpan related-mods> command when it comes to finding related
modules for the modules listed in this Acme::CPANModules module.
See L<App::lcpan::Cmd::related_mods> for more details on how "related modules"
are found.
=head1 HOMEPAGE
Please visit the project's homepage at L<https://metacpan.org/release/Acme-CPANModules-MIMETypes>.
( run in 1.597 second using v1.01-cache-2.11-cpan-b85c58fdc1d )