Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I will try to explain this as clearly as I can. I would appreciate your help very much.
I am using File::MMagic module to determine if a particular file is an mpeg file. I have tried this on 2 separate hosted linux systems.
Here is what I do
use File::MMagic; my $magicFile = '/usr/share/file/magic.mime'; my $mm = new File::MMagic->new($magicFile); my $filePath = $ARGV[0]; my $fh = new FileHandle "< $filePath"; my $res = $mm->checktype_filehandle($fh); print "$res\n";
I upload mp3 file via HTML form and then check its mime type. For the same file, it worked on one system, but failed on the other.
I get the following error
Invalid type 'regex' at line 271 Can't use an undefined value as an ARRAY reference at /usr/lib/perl5/s +ite_perl/5.8.8/File/MMagic.pm line 767, <GEN0> line 276.
I checked the Perl module version using
perl -MFile::MMagic -le 'print $File::MMagic::VERSION'
It showed 1.27 on both systems
if I do a uname -a, it gives me
For the system where it fails,
uname -a Linux xxx.com 2.6.18-238.12.1.el5 #1 SMP Tue May 31 13:22:04 EDT 2011 +x86_64 x86_64 x86_64 GNU/Linux
For the system where it works,
Linux xxx.com 2.6.18-028stab095.1-ent #1 SMP Mon Oct 24 20:45:18 MSD 2 +011 i686 i686 i386 GNU/Linux
I even ftp'd the mpeg file on which it is failing, to the system where it works. It did not have problems and determined the mime type fine.
What confuses me it that existing mp3 files work fine on both systems. But if I upload a file using http, it seems to be failing on one of the systems. It appears like files uploaded via http on one of the systems
Any suggestions as to why this may be happening. Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem with uploaded (http) files with File::MMagic
by CountZero (Bishop) on Dec 22, 2012 at 15:33 UTC | |
by Anonymous Monk on Dec 22, 2012 at 16:03 UTC | |
by roboticus (Chancellor) on Dec 22, 2012 at 16:42 UTC | |
|
Re: Problem with uploaded (http) files with File::MMagic
by Anonymous Monk on Dec 22, 2012 at 17:36 UTC | |
by roboticus (Chancellor) on Dec 24, 2012 at 15:55 UTC |