V
Vilmos Soti
Hello,
File::MMagic doesn't seem to recognize rar files. (tar is ok).
The machine is running Debian Etch. Here is the perl version:
$ perl -v
This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
Copyright 1987-2006, Larry Wall
....
Here is the version of File::MMagic:
$ head -3 /usr/share/perl5/File/MMagic.pm
# File::MMagic
#
# $Id: MMagic.pm 198 2006-01-30 05:24:17Z knok $
$
Here is my script:
############################## Script starts ##############################
#!/usr/bin/perl -w
use strict;
use File::MMagic;
my $magic = new File::MMagic;
my $type;
foreach my $file (<c.*>) {
$type = $magic->checktype_filename ("$file");
print "$file, $type\n";
system ("file $file");
print "\n";
}
############################## Script ends ##############################
And here is the output of the script:
$ ./a
c.rar, application/octet-stream
c.rar: RAR archive data, v1d, os: Win32
c.tar, application/x-gtar
c.tar: POSIX tar archive
$
Here are the last two lines from /usr/share/perl5/File/MMagic.pm:
# RAR archiver (Greg Roelofs, (e-mail address removed))
0 string Rar! application/x-rar
And here are the first few characters from c.rar:
$ xxd c.rar | head -1
0000000: 5261 7221 1a07 00cf 9073 0000 0d00 0000 Rar!.....s......
$
Do I do anything wrong or is it something else?
Thanks for your time, Vilmos
File::MMagic doesn't seem to recognize rar files. (tar is ok).
The machine is running Debian Etch. Here is the perl version:
$ perl -v
This is perl, v5.8.8 built for i486-linux-gnu-thread-multi
Copyright 1987-2006, Larry Wall
....
Here is the version of File::MMagic:
$ head -3 /usr/share/perl5/File/MMagic.pm
# File::MMagic
#
# $Id: MMagic.pm 198 2006-01-30 05:24:17Z knok $
$
Here is my script:
############################## Script starts ##############################
#!/usr/bin/perl -w
use strict;
use File::MMagic;
my $magic = new File::MMagic;
my $type;
foreach my $file (<c.*>) {
$type = $magic->checktype_filename ("$file");
print "$file, $type\n";
system ("file $file");
print "\n";
}
############################## Script ends ##############################
And here is the output of the script:
$ ./a
c.rar, application/octet-stream
c.rar: RAR archive data, v1d, os: Win32
c.tar, application/x-gtar
c.tar: POSIX tar archive
$
Here are the last two lines from /usr/share/perl5/File/MMagic.pm:
# RAR archiver (Greg Roelofs, (e-mail address removed))
0 string Rar! application/x-rar
And here are the first few characters from c.rar:
$ xxd c.rar | head -1
0000000: 5261 7221 1a07 00cf 9073 0000 0d00 0000 Rar!.....s......
$
Do I do anything wrong or is it something else?
Thanks for your time, Vilmos