You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Issac Goldstand <ne...@writeme.com> on 2001/05/30 17:21:22 UTC

[OT] mod_mime_magic in perl?

Does anyone know if there is a perl module that implements the features of Apache's mod_mime_magic module?  (e.g., you give it a file handle, or data and it tries to autodetect the correct mime-type)

  Issac

Internet is a wonderful mechanism for making a fool of
yourself in front of a very large audience.
  --Anonymous

Moving the mouse won't get you into trouble...  Clicking it might.
  --Anonymous

PGP Key 0xE0FA561B - Fingerprint:
7E18 C018 D623 A57B 7F37 D902 8C84 7675 E0FA 561B





Re: [OT] mod_mime_magic in perl?

Posted by "Randal L. Schwartz" <me...@stonehenge.com>.
>>>>> "Issac" == Issac Goldstand <ne...@writeme.com> writes:

Issac> Well, it looks great except that most of the types are just
Issac> different flavors of text/plain...  If you do implement real
Issac> magic files (look at the files the Apache uses for good example
Issac> magic files), or even get a bigger list in your module, PLEASE
Issac> let me know.  Aside from that lack, it's perfect for me.

There's File::MMagic in the CPAN, extracted from the file(1) PPT
command, which uses standard magic-format files.  You could certainly
hook that up to do your equivalent of mod_mime_magic.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<me...@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Re: [OT] mod_mime_magic in perl?

Posted by barries <ba...@slaysys.com>.
On Thu, May 31, 2001 at 03:08:03PM +0200, Issac Goldstand wrote:
> Aside from that lack, it's perfect for me.

Feel like patching in a magic-file parser?  I'm swamped at the moment.

- Barrie

Re: [OT] mod_mime_magic in perl?

Posted by Issac Goldstand <ne...@writeme.com>.
> On Wed, May 30, 2001 at 05:21:22PM +0200, Issac Goldstand wrote:
> > Does anyone know if there is a perl module that implements the features
of Apache's mod_mime_magic module?  (e.g., you give it a file handle, or
data and it tries to autodetect the correct mime-type)
>
> Here's a module (File::Type) that I've been meaning to clean up for CPAN
> for a while.  It's in alpha, but it works for me so far.
>
> http://slaysys.com/src/Type.pm
>
> The "magic" it refers to must be a Perl data structure, not a "real"
> magic file, though I'd really like to get to parsing real magic files.
>
> If you want to use it, let me know and I'll CPAN it sooner.  It will
> need some MIME types added or a parser for a "real" MIME types file.

Well, it looks great except that most of the types are just different
flavors of text/plain...  If you do implement real magic files (look at the
files the Apache uses for good example magic files), or even get a bigger
list in your module, PLEASE let me know.  Aside from that lack, it's perfect
for me.

  Issac

Internet is a wonderful mechanism for making a fool of
yourself in front of a very large audience.
  --Anonymous

Moving the mouse won't get you into trouble...  Clicking it might.
  --Anonymous

PGP Key 0xE0FA561B - Fingerprint:
7E18 C018 D623 A57B 7F37 D902 8C84 7675 E0FA 561B


Re: [OT] mod_mime_magic in perl?

Posted by barries <ba...@slaysys.com>.
On Wed, May 30, 2001 at 05:21:22PM +0200, Issac Goldstand wrote:
> Does anyone know if there is a perl module that implements the features of Apache's mod_mime_magic module?  (e.g., you give it a file handle, or data and it tries to autodetect the correct mime-type)

Here's a module (File::Type) that I've been meaning to clean up for CPAN
for a while.  It's in alpha, but it works for me so far.

http://slaysys.com/src/Type.pm

The "magic" it refers to must be a Perl data structure, not a "real"
magic file, though I'd really like to get to parsing real magic files.

If you want to use it, let me know and I'll CPAN it sooner.  It will
need some MIME types added or a parser for a "real" MIME types file.

- Barrie