/usr/share/perl5/HTTP/OAI/ResumptionToken.pm is in libhttp-oai-perl 3.27-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | package HTTP::OAI::ResumptionToken;
use strict;
use warnings;
use HTTP::OAI::SAXHandler qw/ :SAX /;
use vars qw( @ISA );
@ISA = qw( HTTP::OAI::Encapsulation );
use overload "bool" => \¬_empty;
sub new {
my ($class,%args) = @_;
my $self = $class->SUPER::new(%args);
$self->resumptionToken($args{resumptionToken}) unless $self->resumptionToken;
$self->expirationDate($args{expirationDate}) unless $self->expirationDate;
$self->completeListSize($args{completeListSize}) unless $self->completeListSize;
$self->cursor($args{cursor}) unless $self->cursor;
$self;
}
sub resumptionToken { shift->_elem('resumptionToken',@_) }
sub expirationDate { shift->_attr('expirationDate',@_) }
sub completeListSize { shift->_attr('completeListSize',@_) }
sub cursor { shift->_attr('cursor',@_) }
sub not_empty { defined($_[0]->resumptionToken) and length($_[0]->resumptionToken) > 0 }
sub is_empty { !not_empty(@_) }
sub generate {
my ($self) = @_;
return unless (my $handler = $self->get_handler);
my $attr;
while(my ($key,$value) = each %{$self->_attr}) {
$attr->{"{}$key"} = {'Name'=>$key,'LocalName'=>$key,'Value'=>$value,'Prefix'=>'','NamespaceURI'=>'http://www.openarchives.org/OAI/2.0/'};
}
g_data_element($handler,'http://www.openarchives.org/OAI/2.0/','resumptionToken',$attr,$self->resumptionToken);
}
sub end_element {
my ($self,$hash) = @_;
$self->SUPER::end_element($hash);
if( lc($hash->{Name}) eq 'resumptiontoken' ) {
my $attr = $hash->{Attributes};
$self->resumptionToken($hash->{Text});
$self->expirationDate($attr->{'{}expirationDate'}->{'Value'});
$self->completeListSize($attr->{'{}completeListSize'}->{'Value'});
$self->cursor($attr->{'{}cursor'}->{'Value'});
}
#warn "Got RT: $hash->{Text}";
}
1;
__END__
=head1 NAME
HTTP::OAI::ResumptionToken - Encapsulates an OAI resumption token
=head1 METHODS
=over 4
=item $rt = new HTTP::OAI::ResumptionToken
This constructor method returns a new HTTP::OAI::ResumptionToken object.
=item $token = $rt->resumptionToken([$token])
Returns and optionally sets the resumption token string.
=item $ed = $rt->expirationDate([$rt])
Returns and optionally sets the expiration date of the resumption token.
=item $cls = $rt->completeListSize([$cls])
Returns and optionally sets the cardinality of the result set.
=item $cur = $rt->cursor([$cur])
Returns and optionally sets the index of the first record (of the current page) in the result set.
=back
=head1 NOTE - Completing incomplete list
The final page of a record list which has been split using resumption tokens must contain an empty resumption token.
|