Mailing List Archive

Patch for Catalyst-Plugin-Static-0.07
I had problems installing File::MimeInfo::Magic on win32 so I would suggest using LWP::MediaTypes instead:



use LWP::MediaTypes qw(guess_media_type);

...

my $type = shift || guess_media_type $path;





One can still use File::MimeInfo::Magic within the application and supply mimetype as an argument to Static.



Would that be ok?

Matthias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.rawmode.org/pipermail/catalyst-dev/attachments/20050715/01634e5b/attachment.htm
Patch for Catalyst-Plugin-Static-0.07 [ In reply to ]
Matthias Waldorf wrote:
> I had problems installing File::MimeInfo::Magic on win32 so I would
> suggest using LWP::MediaTypes instead:

I agree that there needs to be a better solution than using
File::MimeInfo, but LWP::MediaTypes seems a bit sparse on the types it
recognizes. For example, I don't even see text/css in the media.types
file. Firefox will not render a page properly if you don't send your
css files as text/css, and I know this has caused problems for many
people, since text/css was missing in older versions of shared-mime-info
too.

-Andy
Patch for Catalyst-Plugin-Static-0.07 [ In reply to ]
Dear Andy,

you are right, LWP::MediaTypes needs help for some files. I used to call it
like this (this solves the problem with Firefox):

use LWP::MediaTypes qw(add_type guess_media_type);
BEGIN {
add_type 'text/css' => qw(css);
}

This could either be done inside Static.pm or within the calling
application. I'm sure there are better solutions, but LWP::MediaTypes should
be available everywhere and you can still use another module and pass the
mimetype to Static.pm.

With kind regards,
Matthias
Patch for Catalyst-Plugin-Static-0.07 [ In reply to ]
On 7/15/05, Andy Grundman <andy@hybridized.org> wrote:
> Matthias Waldorf wrote:
> > I had problems installing File::MimeInfo::Magic on win32 so I would
> > suggest using LWP::MediaTypes instead:
>
> I agree that there needs to be a better solution than using
> File::MimeInfo, but LWP::MediaTypes seems a bit sparse on the types it
> recognizes. For example, I don't even see text/css in the media.types
> file. Firefox will not render a page properly if you don't send your
> css files as text/css, and I know this has caused problems for many
> people, since text/css was missing in older versions of shared-mime-info
> too.

What about using File::MimeInfo if it's available, otherwise dropping
into LWP::MediaTypes if it's not and adding the necessary items?

Rob