| OAI-Harvester documentation | Contained in the OAI-Harvester distribution. |
Net::OAI::Identify - Results of the Identify OAI-PMH verb.
Returns the name of the repostiory.
Returns the base URL used by the repository.
Returns the version of the OAI-PMH used by the repository.
Returns the earlies datestamp for records available in the repository.
Indicates the way the repository works with deleted records. Should return no, transient or persistent.
Returns the granularity used by the repository.
Returns the administrative email address for the repository. Since the adminEmail elelemnt is allowed to repeat you will get all the emails (if more than one are specified) by using adminEmail in a list context.
$email = $identity->adminEmail();
@emails = $identity->adminEmails();
Returns the types of compression that the archive supports. Since the compression element may repeat you may get all the values by using compression() in a list context.
$compression = $identity->compression();
@compressions = $identity->compressions();
| OAI-Harvester documentation | Contained in the OAI-Harvester distribution. |
package Net::OAI::Identify; use strict; use base qw( XML::SAX::Base ); use base qw( Net::OAI::Base );
sub new { my ( $class, %opts ) = @_; my $self = bless \%opts, ref( $class ) || $class; $self->{ repositoryName } = ''; $self->{ baseUrl } = ''; $self->{ protocolVersion } = ''; $self->{ earliestDatestamp } = ''; $self->{ deletedRecord } = ''; $self->{ granularity } = ''; $self->{ adminEmail } = ''; $self->{ adminEmails } = []; $self->{ compression } = ''; $self->{ compressions } = []; $self->{ insideDescription } = 0; return( $self ); }
sub repositoryName { my $self = shift; return( $self->{ repositoryName } ); }
sub baseURL { my $self = shift; return( $self->{ baseURL } ); }
sub protocolVersion { my $self = shift; return( $self->{ protocolVersion } ); }
sub earliestDatestamp { my $self = shift; return( $self->{ earliestDatestamp } ); }
sub deletedRecord { my $self = shift; return( $self->{ deletedRecord } ); }
sub granularity { my $self = shift; return( $self->{ granularity } ); }
sub adminEmail { my $self = shift; if ( wantarray() ) { return( @{ $self->{ adminEmails } } ); } return( $self->{ adminEmails }[ 0 ] ); }
sub compression { my $self = shift; if ( wantarray() ) { return( @{ $self->{ compressions } } ); } return( $self->{ compressions }[ 0 ] ); } ## SAX Handlers sub start_element { my ( $self, $element ) = @_; push( @{ $self->{ tagStack } }, $element->{ Name } ); $self->{ insideDescription } = 1 if $element->{ Name } eq 'description'; } sub end_element { my ( $self, $element ) = @_; ## store and reset elements that can have multiple values if ( $element->{ Name } eq 'adminEmail' ) { Net::OAI::Harvester::debug( "got adminEmail in Identify" ); push( @{ $self->{ adminEmails } }, $self->{ adminEmail } ); $self->{ adminEmail } = ''; } elsif ( $element->{ Name } eq 'compression' ) { Net::OAI::Harvester::debug( "got compression in Identify" ); push( @{ $self->{ compressions } }, $self->{ compression } ); $self->{ compression } = ''; } pop( @{ $self->{ tagStack } } ); $self->{ insideDescription } = 0 if $element->{ Name } eq 'description'; } sub characters { my ( $self, $characters ) = @_; $self->{ $self->{ tagStack }[-1] } .= $characters->{ Data } unless $self->{ insideDescription }; } 1;