On Thu, Feb 10, 2011 at 4:37 PM, Oleg A. Mamontov <oleg@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.