Subject: | File::MimeInfo::Magic and masked values |
Date: | Wed, 01 Aug 2007 17:25:02 -0400 |
To: | bug-File-MimeInfo [...] rt.cpan.org |
From: | Chapman Flack <jflack [...] math.purdue.edu> |
When a match rule has a mask, the module currently uses the mask
to mask off the input read from the file, but compares it to
the original (not masked off) value from the match rule, which
probably isn't going to match.
You can see the problem by creating a file with first line
12345678CRDXvrsn
and confirming that it *fails* to match the rule for
application/vnd.corel-draw. (You could confirm the problem
using other matches that have masks, too.)
Fix: suggest adding just before the line 'my $end = $o + $l + $r;'
the following:
$v &= ( my $wtf = $m ) if defined $m;
(I got tired of trying to determine why the simple
$v &= $m if defined $m;
didn't work, at least in perl 5.8.8 on Solaris; it
causes a 'Modification of a read-only' error at a
different line, later in the run, I'm guessing a
perl bug, and can't chase *everything* down. The line above
works.)
Chapman Flack
mathematics
Purdue