Skip Menu |
 

This queue is for tickets about the File-MMagic CPAN distribution.

Report information
The Basics
Id: 80517
Status: new
Priority: 0/
Queue: File-MMagic

People
Owner: Nobody in particular
Requestors: sakamoto_bc [...] tsnr.com
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in:
  • 1.28
  • 1.29
Fixed in: (no value)



Subject: addFileExts() not work for checktype_byfilename
Download (untitled) / with headers
text/plain 231b
I expect the test.pl returns 'application/excel-s', but it doesn't. I use perl 5.8.9 on FreeBSD box and I install p5-File-MMagic ports. I find Scalar::Util::weaken() cause this problem but I'm not sure about memory leaks. Thanks.
Subject: test.pl
Download test.pl
text/x-perl 232b
use File::MMagic; my $file = "/tmp/sample.xls"; my $magic = new File::MMagic; $magic->addFileExts('\\.xls$', 'application/excel-s'); my $type = $magic->checktype_byfilename($file); print("checktype_byfilename:" . $type . "\n");
Subject: MMagic.pm.patch
Download MMagic.pm.patch
text/x-diff 723b
*** MMagic.pm.old 2012-10-31 15:47:37.000000000 +0900 --- MMagic.pm 2012-10-31 15:47:50.000000000 +0900 *************** *** 740,746 **** $fname =~ s/^.*\///; for my $regex (keys %{$self->{FILEEXTS}}) { ! Scalar::Util::weaken($self->{FILEEXTS}); if ($fname =~ /$regex/i) { if ((defined $type && $type !~ /;/) || (! defined $type)) { $type = $self->{FILEEXTS}->{$regex}; # has no x-type param --- 740,746 ---- $fname =~ s/^.*\///; for my $regex (keys %{$self->{FILEEXTS}}) { ! # Scalar::Util::weaken($self->{FILEEXTS}); if ($fname =~ /$regex/i) { if ((defined $type && $type !~ /;/) || (! defined $type)) { $type = $self->{FILEEXTS}->{$regex}; # has no x-type param


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.