File Coverage

lib/Amazon/SimpleDB/QueryResponse.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package Amazon::SimpleDB::QueryResponse;
2 1     1   1954 use strict;
  1         2  
  1         55  
3 1     1   7 use warnings;
  1         2  
  1         35  
4              
5 1     1   6 use base 'Amazon::SimpleDB::Response';
  1         2  
  1         120  
6              
7             use Amazon::SimpleDB::Item;
8             use Carp qw( croak );
9              
10             sub new {
11             my $class = shift;
12             my $args = shift || {};
13             croak "No domain" unless $args->{domain};
14             return $class->SUPER::new($args);
15             }
16              
17             sub results {
18             my $self = shift;
19             my $results = $self->{content}->{QueryResponse}{QueryResult}{ItemName};
20             $self->{next} = $self->{content}->{QueryResponse}{QueryResult}{NextToken};
21             my @items = map {
22             Amazon::SimpleDB::Item->new(
23             {
24             name => $_,
25             domain => $self->{domain},
26             account => $self->{account}
27             }
28             );
29             } @$results;
30             return wantarray ? @items : $items[0];
31             }
32              
33             sub next { return $_[0]->{next} }
34              
35             1;
36              
37             __END__