[Dancer-users] mime types

damien krotkine dkrotkine at gmail.com
Fri Feb 11 14:40:42 CET 2011


Hi guys,

As reported by Chris,
I think this whole thread is linked to issue GH#136. This issues was
fixed, but the fix was then removed accidentally by an other commit.

Chris has proposed to reintroduce the fix ( basically just  BEGIN {
MIME::Types->new(only_complete => 1);  }   )

He has also provided a test to check it.

Please check his PR#310  ( https://github.com/sukria/Dancer/pull/310/ )

I think that's all we need for now, but don't take my word for it :)
Have a look at it, and possibly propose additional changes, or a
better solution.

In any case, it'd be good to gather the efforts on this fix

Thanks

On 10 February 2011 19:25, Flavio Poletti <polettix at gmail.com> wrote:
> On Thu, Feb 10, 2011 at 4:37 PM, Oleg A. Mamontov <oleg at mamontov.net> wrote:
>>
>> After some debugging i found that MIME::Types (used in Dancer::MIME)
>> read and parse mime types from it DATA handle.
>> This handle is opening by Perl during module load procedure. But
>> subsequent
>> reads occured in &MIME::Types::init (which called from constructor).
>
> ...
>>
>> I propose three different solutions:
>>
>> 1. Remove MIME::Types from Dancer::MIME completely :)
>>
>> 2. Explicitly call &MIME::Types::init early (before fork):
>>
>>   package Dancer::MIME;
>>   use strict;
>>   use warnings;
>>   use base 'Dancer::Object::Singleton';
>>   use MIME::Types;
>>
>>   MIME::Types->init;
>>
>> 3. Use MIME::Types later (in &Dancer::MIME::init):
>>
>>   sub init {
>>     my ($class, $instance) = @_;
>>     eval "use MIME::Types";
>>     $instance->mime_type(MIME::Types->new(only_complete => 1));
>>     $instance->aliases({});
>>   }
>>
>
> I would dare to propose two additional potential solutions:
> 4. Solve the issue in MIME::Type, the author is usually very responsive and
> he should be willing to accept patches
> 5. Investigate the possibility to use Media::Type::Simple, from the feedback
> page of MIME::Type it seems that this module does the same things of
> MIME::Type but with additional features.
>
> I can try to propose a patch for MIME::Type to MARKOV (i.e. start working on
> solution 4).
> Cheers,
>     Flavio.
> _______________________________________________
> Dancer-users mailing list
> Dancer-users at perldancer.org
> http://www.backup-manager.org/cgi-bin/listinfo/dancer-users
>
>


More information about the Dancer-users mailing list