equal
deleted
inserted
replaced
22 |
22 |
23 sub new { |
23 sub new { |
24 my $class = ref $_[0] ? ref shift : shift; |
24 my $class = ref $_[0] ? ref shift : shift; |
25 my $self = bless {} => $class; |
25 my $self = bless {} => $class; |
26 my $r = shift; |
26 my $r = shift; |
27 $r = s/\s*$//; # should match any \r or \n too |
27 $r =~ s/\s*$//; # should match any \r or \n too |
28 |
28 |
29 # decode the status |
29 # decode the status |
30 if (($self->{error_code}) = $r =~ /^E(.)/) { |
30 if (($self->{error_code}) = $r =~ /^E(.)/) { |
31 $self->{ok} = 0; |
31 $self->{ok} = 0; |
32 } |
32 } |
47 } |
47 } |
48 |
48 |
49 sub data { |
49 sub data { |
50 my $self = shift; |
50 my $self = shift; |
51 return undef if not $self->{ok}; |
51 return undef if not $self->{ok}; |
52 return $self->{result}; |
52 return $self->{data}; |
53 } |
53 } |
54 |
54 |
55 sub error { |
55 sub error { |
56 my $self = shift; |
56 my $self = shift; |
57 return $self->{ok} ? undef : $self->{error_code}; |
57 return $self->{ok} ? undef : $self->{error_code}; |