[Dancer-users] mime types
Flavio Poletti
polettix at gmail.com
Thu Feb 10 19:25:13 CET 2011
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.backup-manager.org/pipermail/dancer-users/attachments/20110210/f1e2e0dc/attachment.htm>
More information about the Dancer-users
mailing list