[Dancer-users] mime types

ambs ambs+dancer at perl-hackers.net
Thu Feb 10 17:04:32 CET 2011


On 10/02/2011 16:01, Oleg A. Mamontov wrote:
>>> 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({});
>>>     }
>>
>> Did you try both solutions? Personally I prefer the first one and I'm happy to prepare the patch on git.
>
> Yes and preffer the first one too :)
> But drawback of this solution is loss of lazy initialization.
> On my iMac this is + ~30ms to Dancer startup.

Well, Dancer doesn't start that often.

But, sukria, what do you say? You're the boss :D

ambs


More information about the Dancer-users mailing list