Subject: | File::Type uselessly copies contents |
File::Type doubles the code of having a file in memory.
For example
use File::Type;
my $foo = 'x' x 10000000; # A 10 meg string
my $mime = File::Type->checktype_contents($foo);
That will allocate _another_ 10 meg of data. Rather than just take what it needs off the head of the file, File::Type seems to copy the entire thing (although only once).
Might want to add a little more code to take care you are working with the alias directly, rather than copying, or copy only the small part of the file you need.