Skip Menu |

This queue is for tickets about the Convert-BinHex CPAN distribution.

Report information
The Basics
Id: 124203
Status: new
Priority: 0/
Queue: Convert-BinHex

People
Owner: Nobody in particular
Requestors: dmacks [...] netspace.org
Cc:
AdminCc:

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



Subject: Operator-precedence mistake in platform checks
Date: Tue, 23 Jan 2018 23:47:45 -0500
To: <bug-Convert-BinHex [...] rt.cpan.org>
From: Daniel Macks <dmacks [...] netspace.org>
The following is used in several places (binhex.pl, debinhex.pl, BinHex.pm) to determine if the platform is a certain string: if ($^O||'' eq "MacOS") { # binhex.pl line 123 The intent is probably to have a fallback if the usual perl variable is not set, which should be interpreted as: if (($^O||'') eq "MacOS") { # intended meaning and only be true on MacOS platform. But || binds more weakly than eq, so it is instead acting as: if ($^O||('' eq "MacOS")) { # actual meaning and is true on all platforms where $^O is nonzero. That means code such as Mac::Files::FSpGetCatInfo is run on non-Mac platforms and fails badly. Adding parens as in the "intended meaning" example seems to resolve it. A cleaner way (self-documenting the fallback, and remembering that treating a string as a boolean isn't the same as checking whether it is set) is: if (defined $^O and $^O eq "MacOS") { dan -- Daniel Macks dmacks@netspace.org