This file is indexed.

/usr/share/perl5/HTTP/OAI/Identify.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
 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
package HTTP::OAI::Identify;

use strict;
use warnings;

use HTTP::OAI::SAXHandler qw( :SAX );

use vars qw( @ISA );
@ISA = qw( HTTP::OAI::Response );

sub new {
	my ($class,%args) = @_;
	delete $args{'harvestAgent'}; # Otherwise we get a memory cycle with $h->repository($id)!
	for(qw( adminEmail compression description )) {
		$args{$_} ||= [];
	}
	$args{handlers}->{description} ||= "HTTP::OAI::Metadata";
	my $self = $class->SUPER::new(%args);

	$self->verb('Identify') unless $self->verb;
	$self->baseURL($args{baseURL}) unless $self->baseURL;
	$self->adminEmail($args{adminEmail}) if !ref($args{adminEmail}) && !$self->adminEmail;
	$self->protocolVersion($args{protocolVersion} || '2.0') unless $self->protocolVersion;
	$self->repositoryName($args{repositoryName}) unless $self->repositoryName;
	$self->earliestDatestamp($args{earliestDatestamp}) unless $self->earliestDatestamp;
	$self->deletedRecord($args{deletedRecord}) unless $self->deletedRecord;
	$self->granularity($args{granularity}) unless $self->granularity;

	$self;
}

sub adminEmail {
	my $self = shift;
	push @{$self->{adminEmail}}, @_;
	return wantarray ?
		@{$self->{adminEmail}} :
		$self->{adminEmail}->[0]
}
sub baseURL { shift->headers->header('baseURL',@_) }
sub compression {
	my $self = shift;
	push @{$self->{compression}}, @_;
	return wantarray ?
		@{$self->{compression}} :
		$self->{compression}->[0];
}
sub deletedRecord { return shift->headers->header('deletedRecord',@_) }
sub description {
	my $self = shift;
	push(@{$self->{description}}, @_);
	return wantarray ?
		@{$self->{description}} :
		$self->{description}->[0];
};
sub earliestDatestamp { return shift->headers->header('earliestDatestamp',@_) }
sub granularity { return shift->headers->header('granularity',@_) }
sub protocolVersion { return shift->headers->header('protocolVersion',@_) };
sub repositoryName { return shift->headers->header('repositoryName',@_) };

sub next {
	my $self = shift;
	return shift @{$self->{description}};
}

sub generate_body {
	my ($self) = @_;
	return unless defined(my $handler = $self->get_handler);

	g_data_element($handler,'http://www.openarchives.org/OAI/2.0/','repositoryName',{},$self->repositoryName);
	g_data_element($handler,'http://www.openarchives.org/OAI/2.0/','baseURL',{},"".$self->baseURL);
	g_data_element($handler,'http://www.openarchives.org/OAI/2.0/','protocolVersion',{},$self->protocolVersion);
	g_data_element($handler,'http://www.openarchives.org/OAI/2.0/','adminEmail',{},$_) for $self->adminEmail;
	g_data_element($handler,'http://www.openarchives.org/OAI/2.0/','earliestDatestamp',{},$self->earliestDatestamp||'0001-01-01');
	g_data_element($handler,'http://www.openarchives.org/OAI/2.0/','deletedRecord',{},$self->deletedRecord||'no');
	g_data_element($handler,'http://www.openarchives.org/OAI/2.0/','granularity',{},$self->granularity) if defined($self->granularity);
	g_data_element($handler,'http://www.openarchives.org/OAI/2.0/','compression',{},$_) for $self->compression;

	for($self->description) {
		g_data_element($handler,'http://www.openarchives.org/OAI/2.0/','description',{},$_);
	}
}

sub start_element {
	my ($self,$hash) = @_;
	my $elem = lc($hash->{LocalName});
	$self->SUPER::start_element($hash);
	if( $elem eq 'description' && !$self->{"in_$elem"} ) {
		$self->{OLDHandler} = $self->get_handler();
		$self->set_handler(my $handler = $self->{handlers}->{$elem}->new());
		$self->description($handler);
		$self->{"in_$elem"} = $hash->{Depth};
		g_start_document($handler);
	}
}

sub end_element {
	my ($self,$hash) = @_;
	my $elem = $hash->{LocalName};
	my $text = $hash->{Text};
	if( defined $text )
	{
		$text =~ s/^\s+//;
		$text =~ s/\s+$//;
	}
	if( defined($self->get_handler) ) {
		if( $elem eq 'description' && $self->{"in_$elem"} == $hash->{Depth} ) {
			$self->SUPER::end_document();
			$self->set_handler($self->{OLDHandler});
			$self->{"in_$elem"} = undef;
		}
	} 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->headers->header($elem,$text);
	}
	$self->SUPER::end_element($hash);
}

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::OAI::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