Skip Menu |

This queue is for tickets about the MIME-Types CPAN distribution.

Report information
The Basics
Id: 49111
Status: resolved
Priority: 0/
Queue: MIME-Types

People
Owner: Nobody in particular
Requestors: GENEHACK [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: (no value)



Subject: by_mediatype doesn't work due to failure to init %list global data structure
The by_mediatype() method that MIME::Types exports has a strictly procedural interface. Unfortunately, the internals of by_mediatype() depend on the %list data structure, and the only way that gets initialized, currently, is if you call MIME::Types->new(). This behavior is not terribly intuitive from the documentation. Here's a (fairly nasty, IMO) patch that kludges around the problem: --- /opt/perl/lib/site_perl/5.10.0/MIME/Types.pm 2009-02-03 06:32:03.000000000 -0500 +++ ./Types.pm 2009-08-28 21:54:43.000000000 -0400 @@ -170,6 +170,8 @@ { my $type = shift; my @found; + init({}) unless( %list ); + if(index($type, '/') >= 0) { my $simplified = MIME::Type->simplified($type); my $mime = $list{$simplified};
serious problem. Have released version 1.28 to fix it. Thanks.