diff -Nurd -x'*~' Convert-BinHex-1.125.orig/bin/binhex.pl Convert-BinHex-1.125/bin/binhex.pl --- Convert-BinHex-1.125.orig/bin/binhex.pl 2015-11-15 14:38:05.000000000 -0500 +++ Convert-BinHex-1.125/bin/binhex.pl 2018-01-23 23:59:50.000000000 -0500 @@ -43,7 +43,7 @@ use Fcntl; use File::Basename; use Carp; -require Mac::Files if (($^O||'') eq "MacOS"); +require Mac::Files if (defined $^O and $^O eq "MacOS"); our $VERSION = '1.125'; # VERSION @@ -82,8 +82,8 @@ my $msg = shift || ''; my $usage = ''; if (open(USAGE, "<$0")) { - while ($_ = <USAGE> and !/^=head1 USAGE/) {}; - while ($_ = <USAGE> and !/^=head1/) {$usage .= $_}; + while (defined($_ = <USAGE>) and !/^=head1 USAGE/) {}; + while (defined($_ = <USAGE>) and !/^=head1/) {$usage .= $_}; close USAGE; } else { @@ -117,7 +117,7 @@ my $outpath = "$outdir/$outname"; $outpath =~ s{/+}{/}g; # If we're on a Mac, we can get the real resource info: - if ($^O||'' eq "MacOS") { + if (defined $^O and $^O eq "MacOS") { # Get and set up type, creator, flags: $has = Mac::Files::FSpGetCatInfo($inpath); diff -Nurd -x'*~' Convert-BinHex-1.125.orig/bin/debinhex.pl Convert-BinHex-1.125/bin/debinhex.pl --- Convert-BinHex-1.125.orig/bin/debinhex.pl 2015-11-15 14:38:05.000000000 -0500 +++ Convert-BinHex-1.125/bin/debinhex.pl 2018-01-23 23:51:26.000000000 -0500 @@ -42,7 +42,7 @@ our $VERSION = '1.125'; # VERSION my $The_OS; -BEGIN { $The_OS = $^O ? $^O : q// } +BEGIN { $The_OS = defined $^O ? $^O : '' } eval { require Mac::Files } if ($The_OS eq "MacOS"); use Getopt::Std; diff -Nurd -x'*~' Convert-BinHex-1.125.orig/lib/Convert/BinHex.pm Convert-BinHex-1.125/lib/Convert/BinHex.pm --- Convert-BinHex-1.125.orig/lib/Convert/BinHex.pm 2015-11-15 14:38:05.000000000 -0500 +++ Convert-BinHex-1.125/lib/Convert/BinHex.pm 2018-01-23 23:50:07.000000000 -0500 @@ -372,6 +372,7 @@ my $self = bless { Data => new Convert::BinHex::Fork, # data fork Rsrc => new Convert::BinHex::Fork, # resource fork + Version => 0, # if caller forgets to set via $self->version }, $class; # basic object # Process params: @@ -836,6 +837,7 @@ # Get more BIN bytes until enough or EOF: my $bin; + $self->{BIN_QUEUE} = '' unless defined $self->{BIN_QUEUE}; while (length($self->{BIN_QUEUE}) < $n) { $FH->read($READBUF, 4096) or last; $self->{BIN_QUEUE} .= $self->{H2B}->next($READBUF); # save BIN @@ -1432,8 +1434,10 @@ sub encode { my ($self, $OUT, $B2H) = @_; my $buf = ''; - require POSIX if $^O||'' eq "MacOS"; - require Fcntl if $^O||'' eq "MacOS"; + if (defined $^O and $^O eq "MacOS") { + require POSIX; + require Fcntl; + } my $fd; # Reset the CRC: @@ -1441,7 +1445,7 @@ # Output the data, calculating the CRC as we go: if (defined($self->{Path})) { # path to fork file - if ($^O||'' eq "MacOS" and $self->{Fork} eq "RSRC") { + if (defined $^O and $^O eq "MacOS" and $self->{Fork} eq "RSRC") { $fd = POSIX::open($self->{Path},&POSIX::O_RDONLY | &Fcntl::O_RSRC); while (POSIX::read($fd, $buf, 2048) > 0) { $self->{CRC} = binhex_crc($buf, $self->{CRC});