--- a/lib/Quancom/Result.pm Mon Jan 05 21:44:56 2009 +0100
+++ b/lib/Quancom/Result.pm Tue Jan 06 02:01:26 2009 +0100
@@ -27,7 +27,8 @@
$r =~ s/\s*$//; # should match any \r or \n too
# decode the status
- if (($self->{error_code}) = $r =~ /^E(.)/) {
+ if ((my $e) = $r =~ /^E(.)/) {
+ $self->{error_code} = unpack("C", $e);
$self->{ok} = 0;
}
elsif (my ($jobid, $data, $csum) = $r =~ /^[DO](..)(.*)(..)$/) {
@@ -62,8 +63,8 @@
return undef if !@_ and $self->{ok};
- return ("checksum error", "character error", "invalid command",
- "invalid width")[ @_ ? $_[0] : $self->{error_code} ];
+ return +("checksum error", "character error", "invalid command",
+ "invalid width")[ defined $_[0] ? $_[0] : $self->{error_code} ];
}
1;