/usr/share/perl5/HTTP/OAI/Identify.pm is in libhttp-oai-perl 4.03-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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | package HTTP::OAI::Identify;
@ISA = qw( HTTP::OAI::Verb );
use strict;
use HTTP::OAI::SAXHandler qw( :SAX );
sub adminEmail { shift->_elem('adminEmail',@_) }
sub baseURL { shift->_elem('baseURL',@_) }
sub compression { shift->_multi('compression',@_) }
sub deletedRecord { shift->_elem('deletedRecord',@_) }
sub description { shift->_multi('description',@_) }
sub earliestDatestamp { shift->_elem('earliestDatestamp',@_) }
sub granularity { shift->_elem('granularity',@_) }
sub protocolVersion { shift->_elem('protocolVersion',@_) }
sub repositoryName { shift->_elem('repositoryName',@_) }
sub next {
my $self = shift;
return shift @{$self->{description}};
}
sub generate_body
{
my( $self, $driver ) = @_;
for(qw( repositoryName baseURL protocolVersion adminEmail earliestDatestamp deletedRecord granularity compression ))
{
foreach my $value ($self->$_)
{
$driver->data_element( $_, $value );
}
}
for($self->description) {
$_->generate( $driver );
}
}
sub start_element {
my ($self,$hash,$r) = @_;
my $elem = lc($hash->{LocalName});
if( $elem eq 'description' && !$self->{"in_$elem"} ) {
$self->set_handler(my $desc = HTTP::OAI::Metadata->new);
$self->description([$self->description, $desc]);
$self->{"in_$elem"} = $hash->{Depth};
}
$self->SUPER::start_element($hash,$r);
}
sub end_element {
my ($self,$hash,$r) = @_;
my $elem = $hash->{LocalName};
my $text = $hash->{Text};
if( defined $text )
{
$text =~ s/^\s+//;
$text =~ s/\s+$//;
}
$self->SUPER::end_element($hash,$r);
if( defined($self->get_handler) ) {
if( $elem eq 'description' && $self->{"in_$elem"} == $hash->{Depth} ) {
$self->set_handler( undef );
$self->{"in_$elem"} = 0;
}
} elsif( $elem eq 'adminEmail' ) {
$self->adminEmail($text);
} elsif( $elem eq 'compression' ) {
$self->compression($text);
} elsif( $elem eq 'baseURL' ) {
$self->baseURL($text);
} elsif( $elem eq 'protocolVersion' ) {
$text = '2.0' if $text =~ /\D/ or $text < 2.0;
$self->protocolVersion($text);
} elsif( defined($text) && length($text) ) {
$self->_elem($elem,$text);
}
}
1;
__END__
=head1 NAME
HTTP::OAI::Identify - Provide access to an OAI Identify response
=head1 SYNOPSIS
use HTTP::OAI::Identify;
my $i = new HTTP::OAI::Identify(
adminEmail=>'billg@microsoft.com',
baseURL=>'http://www.myarchives.org/oai',
repositoryName=>'www.myarchives.org'
);
for( $i->adminEmail ) {
print $_, "\n";
}
=head1 METHODS
=over 4
=item $i = new HTTP::OAI::Identify(-baseURL=>'http://arXiv.org/oai1'[, adminEmail=>$email, protocolVersion=>'2.0', repositoryName=>'myarchive'])
This constructor method returns a new instance of the OAI::Identify module.
=item $i->version
Return the original version of the OAI response, according to the given XML namespace.
=item $i->headers
Returns an HTTP::Headers object. Use $headers->header('headername') to retrive field values.
=item $burl = $i->baseURL([$burl])
=item $eds = $i->earliestDatestamp([$eds])
=item $gran = $i->granularity([$gran])
=item $version = $i->protocolVersion($version)
=item $name = $i->repositoryName($name)
Returns and optionally sets the relevent header. NOTE: protocolVersion will always be '2.0'. Use $i->version to find out the protocol version used by the repository.
=item @addys = $i->adminEmail([$email])
=item @cmps = $i->compression([$cmp])
Returns and optionally adds to the multi-value headers.
=item @dl = $i->description([$d])
Returns the description list and optionally appends a new description $d. Returns an array ref of L<HTTP::OAI::Description|HTTP::OAI::Description>s, or an empty ref if there are no description.
=item $d = $i->next
Returns the next description or undef if no more description left.
=item $dom = $i->toDOM
Returns a XML::DOM object representing the Identify response.
=back
|