No such thing as a small change | |
PerlMonks |
Re: file command replacement (showing the type of a file with perl)by halfcountplus (Hermit) |
on Apr 17, 2012 at 12:41 UTC ( [id://965503]=note: print w/replies, xml ) | Need Help?? |
the File::Type module, although not bad, is clearly less accurate that file. You've misunderstood something. The explicit purpose of File::Type is "to determine the MIME type of that file". 'image/jpeg' is a valid MIME type. 'JPEG image data, JFIF standard 1.01' is not. MIME types are important, eg, in internet transfers -- your browser decides how to treat something based on the MIME type in the http header. The file command (which will give you a mime type too, if you use the --mime switch) can provide more detailed information in a "human readable" form but there is no protocol for this. It looks to me like someone has written a module porting "file" into perl tho: file. However, since the author admits "this implementation is significantly slower than the C version" you might be better off just using backticks ;).
In Section
Seekers of Perl Wisdom
|
|