| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Net::OAI::Identify; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 14 |  |  | 14 |  | 146 | use strict; | 
|  | 14 |  |  |  |  | 26 |  | 
|  | 14 |  |  |  |  | 510 |  | 
| 4 | 14 |  |  | 14 |  | 76 | use base qw( XML::SAX::Base ); | 
|  | 14 |  |  |  |  | 26 |  | 
|  | 14 |  |  |  |  | 379441 |  | 
| 5 | 14 |  |  | 14 |  | 148 | use base qw( Net::OAI::Base ); | 
|  | 14 |  |  |  |  | 59 |  | 
|  | 14 |  |  |  |  | 8861 |  | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | =head1 NAME | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | Net::OAI::Identify - Results of the Identify OAI-PMH verb. | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | =head1 DESCRIPTION | 
| 14 |  |  |  |  |  |  |  | 
| 15 |  |  |  |  |  |  | =head1 METHODS | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | =head2 new() | 
| 18 |  |  |  |  |  |  |  | 
| 19 |  |  |  |  |  |  | =cut | 
| 20 |  |  |  |  |  |  |  | 
| 21 |  |  |  |  |  |  | sub new { | 
| 22 | 4 |  |  | 4 | 1 | 20 | my ( $class, %opts ) = @_; | 
| 23 | 4 |  | 33 |  |  | 36 | my $self = bless \%opts, ref( $class ) || $class; | 
| 24 | 4 |  |  |  |  | 37 | $self->{ repositoryName } = ''; | 
| 25 | 4 |  |  |  |  | 13 | $self->{ baseUrl } = ''; | 
| 26 | 4 |  |  |  |  | 13 | $self->{ protocolVersion } = ''; | 
| 27 | 4 |  |  |  |  | 15 | $self->{ earliestDatestamp } = ''; | 
| 28 | 4 |  |  |  |  | 12 | $self->{ deletedRecord } = ''; | 
| 29 | 4 |  |  |  |  | 12 | $self->{ granularity } = ''; | 
| 30 | 4 |  |  |  |  | 17 | $self->{ adminEmail } = ''; | 
| 31 | 4 |  |  |  |  | 14 | $self->{ adminEmails } = []; | 
| 32 | 4 |  |  |  |  | 13 | $self->{ compression } = ''; | 
| 33 | 4 |  |  |  |  | 13 | $self->{ compressions } = []; | 
| 34 | 4 |  |  |  |  | 12 | $self->{ insideDescription } = 0; | 
| 35 | 4 |  |  |  |  | 15 | return( $self ); | 
| 36 |  |  |  |  |  |  | } | 
| 37 |  |  |  |  |  |  |  | 
| 38 |  |  |  |  |  |  | =head1 repositoryName() | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | Returns the name of the repostiory. | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | =cut | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | sub repositoryName { | 
| 45 | 2 |  |  | 2 | 0 | 7 | my $self = shift; | 
| 46 | 2 |  |  |  |  | 18 | return( $self->{ repositoryName } ); | 
| 47 |  |  |  |  |  |  | } | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | =head1 baseURL() | 
| 50 |  |  |  |  |  |  |  | 
| 51 |  |  |  |  |  |  | Returns the base URL used by the repository. | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  | =cut | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | sub baseURL { | 
| 56 | 0 |  |  | 0 | 0 | 0 | my $self = shift; | 
| 57 | 0 |  |  |  |  | 0 | return( $self->{ baseURL } ); | 
| 58 |  |  |  |  |  |  | } | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | =head1 protocolVersion() | 
| 61 |  |  |  |  |  |  |  | 
| 62 |  |  |  |  |  |  | Returns the version of the OAI-PMH used by the repository. | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | =cut | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | sub protocolVersion { | 
| 67 | 1 |  |  | 1 | 0 | 3 | my $self = shift; | 
| 68 | 1 |  |  |  |  | 9 | return( $self->{ protocolVersion } ); | 
| 69 |  |  |  |  |  |  | } | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | =head1 earliestDatestamp() | 
| 72 |  |  |  |  |  |  |  | 
| 73 |  |  |  |  |  |  | Returns the earlies datestamp for records available in the repository. | 
| 74 |  |  |  |  |  |  |  | 
| 75 |  |  |  |  |  |  | =cut | 
| 76 |  |  |  |  |  |  |  | 
| 77 |  |  |  |  |  |  | sub earliestDatestamp { | 
| 78 | 1 |  |  | 1 | 0 | 3 | my $self = shift; | 
| 79 | 1 |  |  |  |  | 9 | return( $self->{ earliestDatestamp } ); | 
| 80 |  |  |  |  |  |  | } | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | =head1 deletedRecord() | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | Indicates the way the repository works with deleted records. Should | 
| 85 |  |  |  |  |  |  | return I, I or I. | 
| 86 |  |  |  |  |  |  |  | 
| 87 |  |  |  |  |  |  | =cut | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | sub deletedRecord { | 
| 90 | 1 |  |  | 1 | 0 | 4 | my $self = shift; | 
| 91 | 1 |  |  |  |  | 8 | return( $self->{ deletedRecord } ); | 
| 92 |  |  |  |  |  |  | } | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | =head1 granularity() | 
| 95 |  |  |  |  |  |  |  | 
| 96 |  |  |  |  |  |  | Returns the granularity used by the repository. | 
| 97 |  |  |  |  |  |  |  | 
| 98 |  |  |  |  |  |  | =cut | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | sub granularity { | 
| 101 | 1 |  |  | 1 | 0 | 3 | my $self = shift; | 
| 102 | 1 |  |  |  |  | 9 | return( $self->{ granularity } ); | 
| 103 |  |  |  |  |  |  | } | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  | =head1 adminEmail() | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | Returns the administrative email address for the repository. Since the | 
| 108 |  |  |  |  |  |  | adminEmail elelemnt is allowed to repeat you will get all the emails (if more | 
| 109 |  |  |  |  |  |  | than one are specified) by using adminEmail in a list context. | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | $email = $identity->adminEmail(); | 
| 112 |  |  |  |  |  |  | @emails = $identity->adminEmails(); | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | =cut | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  | sub adminEmail { | 
| 117 | 2 |  |  | 2 | 0 | 8 | my $self = shift; | 
| 118 | 2 | 100 |  |  |  | 8 | if ( wantarray() ) { return( @{ $self->{ adminEmails } } ); } | 
|  | 1 |  |  |  |  | 3 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 119 | 1 |  |  |  |  | 5 | return( $self->{ adminEmails }[ 0 ] ); | 
| 120 |  |  |  |  |  |  | } | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | =head1 compression() { | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  | Returns the types of compression that the archive supports. Since the | 
| 125 |  |  |  |  |  |  | compression element may repeat you may get all the values by using | 
| 126 |  |  |  |  |  |  | compression() in a list context. | 
| 127 |  |  |  |  |  |  |  | 
| 128 |  |  |  |  |  |  | $compression = $identity->compression(); | 
| 129 |  |  |  |  |  |  | @compressions = $identity->compressions(); | 
| 130 |  |  |  |  |  |  |  | 
| 131 |  |  |  |  |  |  | =cut | 
| 132 |  |  |  |  |  |  |  | 
| 133 |  |  |  |  |  |  | sub compression { | 
| 134 | 2 |  |  | 2 | 0 | 1144 | my $self = shift; | 
| 135 | 2 | 100 |  |  |  | 9 | if ( wantarray() ) { return( @{ $self->{ compressions } } ); } | 
|  | 1 |  |  |  |  | 4 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 136 | 1 |  |  |  |  | 4 | return( $self->{ compressions }[ 0 ] ); | 
| 137 |  |  |  |  |  |  | } | 
| 138 |  |  |  |  |  |  |  | 
| 139 |  |  |  |  |  |  | ## SAX Handlers | 
| 140 |  |  |  |  |  |  |  | 
| 141 |  |  |  |  |  |  | sub start_element { | 
| 142 | 100 |  |  | 100 | 1 | 665 | my ( $self, $element ) = @_; | 
| 143 | 100 |  |  |  |  | 121 | push( @{ $self->{ tagStack } }, $element->{ Name } ); | 
|  | 100 |  |  |  |  | 230 |  | 
| 144 | 100 | 100 |  |  |  | 546 | $self->{ insideDescription } = 1 if $element->{ Name } eq 'description'; | 
| 145 |  |  |  |  |  |  | } | 
| 146 |  |  |  |  |  |  |  | 
| 147 |  |  |  |  |  |  | sub end_element { | 
| 148 | 100 |  |  | 100 | 1 | 597 | my ( $self, $element ) = @_; | 
| 149 |  |  |  |  |  |  |  | 
| 150 |  |  |  |  |  |  | ## store and reset elements that can have multiple values | 
| 151 | 100 | 100 |  |  |  | 651 | if ( $element->{ Name } eq 'adminEmail' ) { | 
|  |  | 50 |  |  |  |  |  | 
| 152 | 6 |  |  |  |  | 32 | Net::OAI::Harvester::debug( "got adminEmail in Identify" ); | 
| 153 | 6 |  |  |  |  | 7 | push( @{ $self->{ adminEmails } }, $self->{ adminEmail } ); | 
|  | 6 |  |  |  |  | 28 |  | 
| 154 | 6 |  |  |  |  | 15 | $self->{ adminEmail } = ''; | 
| 155 |  |  |  |  |  |  | } | 
| 156 |  |  |  |  |  |  | elsif ( $element->{ Name } eq 'compression' ) { | 
| 157 | 0 |  |  |  |  | 0 | Net::OAI::Harvester::debug( "got compression in Identify" ); | 
| 158 | 0 |  |  |  |  | 0 | push( @{ $self->{ compressions } }, $self->{ compression } ); | 
|  | 0 |  |  |  |  | 0 |  | 
| 159 | 0 |  |  |  |  | 0 | $self->{ compression } = ''; | 
| 160 |  |  |  |  |  |  | } | 
| 161 | 100 |  |  |  |  | 112 | pop( @{ $self->{ tagStack } } ); | 
|  | 100 |  |  |  |  | 188 |  | 
| 162 | 100 | 100 |  |  |  | 502 | $self->{ insideDescription } = 0 if $element->{ Name } eq 'description'; | 
| 163 |  |  |  |  |  |  | } | 
| 164 |  |  |  |  |  |  |  | 
| 165 |  |  |  |  |  |  | sub characters { | 
| 166 | 215 |  |  | 215 | 1 | 1196 | my ( $self, $characters ) = @_; | 
| 167 |  |  |  |  |  |  | $self->{ $self->{ tagStack }[-1] } .= $characters->{ Data } | 
| 168 | 215 | 100 |  |  |  | 1269 | unless $self->{ insideDescription }; | 
| 169 |  |  |  |  |  |  | } | 
| 170 |  |  |  |  |  |  |  | 
| 171 |  |  |  |  |  |  | 1; |