Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

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

Report information
The Basics
Id: 41031
Status: resolved
Priority: 0/
Queue: File-MimeInfo

People
Owner: Nobody in particular
Requestors: jflack [...] math.purdue.edu
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Failure to open file named 0 due to precedence of || vs or
Date: Tue, 18 Nov 2008 10:54:58 -0500
To: bug-File-MimeInfo [...] rt.cpan.org
From: J Chapman Flack <jflack [...] math.purdue.edu>
A user has reported errors like Can't use an undefined value as a symbol reference at .../lib/File/MimeInfo/Magic.pm line 55. when trying to classify a file named "0". The problem turns out to be the idiom: open $fh, '<', $file || return undef; which, to be correct, needs the operator 'or' instead of ||: open $fh, '<', $file or return undef; The two operators have different precedence: the version with || is equivalent to open $fh, '<', ( $file || return undef ); which of course causes undef to be returned if $file is the empty string or "0". Credit to Dan Trinkle for spotting that operator precedence was the problem. There are two lines in Magic.pm and four in MimeInfo.pm to be corrected. Reported for 0.14. Chapman Flack mathematics Purdue
Will release fix in version 0.16