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
|
package HTTP::OAI::ListMetadataFormats;
@ISA = qw( HTTP::OAI::PartialList );
use strict;
sub metadataFormat { shift->item(@_) }
sub start_element {
my ($self,$hash,$r) = @_;
if( !$self->{'in_mdf'} ) {
if( lc($hash->{LocalName}) eq 'metadataformat' ) {
$self->set_handler(my $mdf = HTTP::OAI::MetadataFormat->new);
$self->metadataFormat($mdf);
$self->{'in_mdf'} = $hash->{Depth};
}
}
$self->SUPER::start_element($hash,$r);
}
sub end_element {
my ($self,$hash,$r) = @_;
$self->SUPER::end_element($hash,$r);
if( $self->{'in_mdf'} == $hash->{Depth} ) {
if( lc($hash->{LocalName}) eq 'metadataformat' ) {
HTTP::OAI::Debug::trace( "metadataFormat: " . $self->get_handler->metadataPrefix );
$self->set_handler( undef );
$self->{'in_mdf'} = 0;
}
}
}
1;
__END__
=head1 NAME
HTTP::OAI::ListMetadataFormats - Provide access to an OAI ListMetadataFormats response
=head1 SYNOPSIS
my $r = $h->ListMetadataFormats;
# ListMetadataFormats doesn't use flow control
while( my $rec = $r->next ) {
print $rec->metadataPrefix, "\n";
}
die $r->message if $r->is_error;
=head1 METHODS
=over 4
=item $lmdf = new HTTP::OAI::ListMetadataFormats
This constructor method returns a new HTTP::OAI::ListMetadataFormats object.
=item $mdf = $lmdf->next
Returns either an L<HTTP::OAI::MetadataFormat|HTTP::OAI::MetadataFormat> object, or undef, if no more records are available.
=item @mdfl = $lmdf->metadataFormat([$mdf])
Returns the metadataFormat list and optionally adds a new metadataFormat, $mdf. Returns an array ref of L<HTTP::OAI::MetadataFormat|HTTP::OAI::MetadataFormat>s.
=item $dom = $lmdf->toDOM
Returns a XML::DOM object representing the ListMetadataFormats response.
=back
|