/usr/share/perl5/HTTP/OAI/Set.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 | package HTTP::OAI::Set;
use strict;
use warnings;
use HTTP::OAI::SAXHandler qw/ :SAX /;
use vars qw( @ISA );
@ISA = qw( HTTP::OAI::Encapsulation );
sub new {
my ($class,%args) = @_;
my $self = $class->SUPER::new(%args);
$self->{handlers} = $args{handlers};
$self->setSpec($args{setSpec});
$self->setName($args{setName});
$self->{setDescription} = $args{setDescription} || [];
$self;
}
sub setSpec { shift->_elem('setSpec',@_) }
sub setName { shift->_elem('setName',@_) }
sub setDescription {
my $self = shift;
push(@{$self->{setDescription}}, @_);
return @{$self->{setDescription}};
}
sub next { shift @{shift->{setDescription}} }
sub generate {
my ($self) = @_;
return unless defined(my $handler = $self->get_handler);
g_start_element($handler,'http://www.openarchives.org/OAI/2.0/','set',{});
g_data_element($handler,'http://www.openarchives.org/OAI/2.0/','setSpec',{},$self->setSpec);
g_data_element($handler,'http://www.openarchives.org/OAI/2.0/','setName',{},$self->setName);
for( $self->setDescription ) {
$_->set_handler($handler);
$_->generate;
}
g_end_element($handler,'http://www.openarchives.org/OAI/2.0/','set');
}
sub start_element {
my ($self,$hash) = @_;
my $elem = lc($hash->{Name});
if( $elem eq 'setdescription' ) {
$self->setDescription(my $d = $self->{handlers}->{description}->new(version=>$self->version));
$self->set_handler($d);
g_start_document($d);
}
$self->SUPER::start_element($hash);
}
sub end_element {
my ($self,$hash) = @_;
$self->SUPER::end_element($hash);
my $elem = lc($hash->{Name});
if( $elem eq 'setspec' ) {
die ref($self)." Parse error: Empty setSpec\n" unless $hash->{Text};
$self->setSpec($hash->{Text});
} elsif( $elem eq 'setname' ) {
warn ref($self)." Parse error: Empty setName\n", return
unless $hash->{Text};
$self->setName($hash->{Text});
} elsif( $elem eq 'setdescription' ) {
$self->SUPER::end_document();
$self->set_handler(undef);
}
}
1;
__END__
=head1 NAME
HTTP::OAI::Set - Encapsulates OAI set XML data
=head1 METHODS
=over 4
=item $spec = $s->setSpec([$spec])
=item $name = $s->setName([$name])
These methods return respectively, the setSpec and setName of the OAI Set.
=item @descs = $s->setDescription([$desc])
Returns and optionally adds the list of set descriptions. Returns a reference to an array of L<HTTP::OAI::Description|HTTP::OAI::Description> objects.
=back
|