File Coverage

lib/Amazon/SimpleDB/Domain.pm
Criterion Covered Total %
statement 7 9 77.7
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 10 12 83.3


line stmt bran cond sub pod time code
1             package Amazon::SimpleDB::Domain;
2 2     2   922 use strict;
  2         3  
  2         69  
3 2     2   9 use warnings;
  2         3  
  2         75  
4              
5 2     2   758 use Amazon::SimpleDB::Response;
  0            
  0            
6             use Carp qw( croak );
7              
8             sub new {
9             my $class = shift;
10             my $args = shift || {};
11             my $self = bless $args, $class;
12             croak "No account" unless $self->{account};
13             croak "No (domain) name" unless $self->{name};
14             return $self;
15             }
16              
17             sub account { return $_[0]->{account} }
18             sub name { return $_[0]->{name} }
19             sub delete { return $_[0]->{account}->delete_domain($_[0]->{name}) }
20              
21             # note: limit can be between 1 and 250. default is 100.
22             # note: cannot run longer then 5 seconds or times out.
23             sub query {
24             my $self = shift;
25             my $args = shift || {};
26             my $params = {DomainName => $self->{'name'}};
27             $params->{MaxNumberOfItems} = $args->{'limit'} if $args->{'limit'};
28             $params->{NextToken} = $args->{'next'} if $args->{'next'};
29             $params->{QueryExpression} = $args->{'query'} if $args->{'query'};
30             my $account = $self->{account};
31             return
32             Amazon::SimpleDB::Response->new(
33             http_response => $account->request('Query', $params),
34             domain => $self,
35             account => $self->{account},
36             );
37             }
38              
39             1;
40              
41             __END__