in reply to file type

You can use File::MMagic, but be forewarned, I didn't find it very fast.

Update: ah, good point Arturo. I hadn't fully comprehended the question's substance. Catagorizing by filename extension seems like the best solution.

Replies are listed 'Best First'.
Re: Re: file type
by arturo (Vicar) on Feb 09, 2001 at 03:24 UTC

    That's an interesting approach, but I'd guess it's designed to figure out MIME types. I dunno if different kinds of source code are going to have distinct MIME types (but maybe the module could be hacked so as to recognize them ...). I also note that it seems to work its magic based on the extension, primarily, which is what I suggested above.

    Philosophy can be made out of anything. Or less -- Jerry A. Fodor