File Coverage

blib/lib/HTTP/OAI/ResumptionToken.pm
Criterion Covered Total %
statement 8 22 36.3
branch 1 4 25.0
condition n/a
subroutine 4 10 40.0
pod 5 8 62.5
total 18 44 40.9


line stmt bran cond sub pod time code
1             package HTTP::OAI::ResumptionToken;
2              
3             @ISA = qw( HTTP::OAI::MemberMixin XML::SAX::Base );
4              
5 11     11   101 use strict;
  11         23  
  11         460  
6              
7 11     11   65 use overload "bool" => \¬_empty;
  11         19  
  11         116  
8              
9             our $VERSION = '4.13';
10              
11 6     6 1 336 sub resumptionToken { shift->_elem('resumptionToken',@_) }
12 0     0 1 0 sub expirationDate { shift->_elem('expirationDate',@_) }
13 0     0 1 0 sub completeListSize { shift->_elem('completeListSize',@_) }
14 0     0 1 0 sub cursor { shift->_elem('cursor',@_) }
15              
16 2 50   2 0 175 sub not_empty { defined($_[0]->resumptionToken) and length($_[0]->resumptionToken) > 0 }
17 0     0 0   sub is_empty { !not_empty(@_) }
18              
19             sub generate {
20 0     0 0   my( $self, $driver ) = @_;
21              
22 0           $driver->data_element( 'resumptionToken', $self->resumptionToken,
23             expirationDate => scalar($self->expirationDate),
24             completeListSize => scalar($self->completeListSize),
25             cursor => scalar($self->cursor),
26             );
27             }
28              
29             sub end_element {
30 0     0 1   my ($self,$hash) = @_;
31 0           $self->SUPER::end_element($hash);
32 0 0         if( lc($hash->{LocalName}) eq 'resumptiontoken' ) {
33 0           $self->resumptionToken($hash->{Text});
34              
35 0           my $attr = $hash->{Attributes};
36 0           $self->expirationDate($attr->{'{}expirationDate'}->{'Value'});
37 0           $self->completeListSize($attr->{'{}completeListSize'}->{'Value'});
38 0           $self->cursor($attr->{'{}cursor'}->{'Value'});
39             }
40             }
41              
42             1;
43              
44             __END__