| 1 | package HTTP::OAI::Identify; | ||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||
| 3 | 11 | @ISA = qw( HTTP::OAI::Verb ); | |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||
| 5 | 11 | ▶ | use strict; | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||
| 7 | 11 | our $VERSION = '4.07'; | |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||
| 9 | 11 | ▶ | use HTTP::OAI::SAXHandler qw( :SAX ); | ||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||
| 11 | 7 | ▶ | sub adminEmail { shift->_elem('adminEmail',@_) } | ||||||||||||||||||||||||||||
|
Subroutine
adminEmail: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 12 | 28 | ▶ | sub baseURL { shift->_elem('baseURL',@_) } | ||||||||||||||||||||||||||||
|
Subroutine
baseURL: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 13 | 1 | ▶ | sub compression { shift->_multi('compression',@_) } | ||||||||||||||||||||||||||||
|
Subroutine
compression: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 14 | 2 | ▶ | sub deletedRecord { shift->_elem('deletedRecord',@_) } | ||||||||||||||||||||||||||||
|
Subroutine
deletedRecord: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 15 | 9 | ▶ | sub description { shift->_multi('description',@_) } | ||||||||||||||||||||||||||||
|
Subroutine
description: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 16 | 1 | ▶ | sub earliestDatestamp { shift->_elem('earliestDatestamp',@_) } | ||||||||||||||||||||||||||||
|
Subroutine
earliestDatestamp: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 17 | 2 | ▶ | sub granularity { shift->_elem('granularity',@_) } | ||||||||||||||||||||||||||||
|
Subroutine
granularity: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 18 | 12 | ▶ | sub protocolVersion { shift->_elem('protocolVersion',@_) } | ||||||||||||||||||||||||||||
|
Subroutine
protocolVersion: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 19 | 5 | ▶ | sub repositoryName { shift->_elem('repositoryName',@_) } | ||||||||||||||||||||||||||||
|
Subroutine
repositoryName: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||
| 21 | sub next { | ||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||
|
Subroutine
next: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||
| 23 | 0 | return shift @{$self->{description}}; | |||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||
| 26 | sub generate_body | ||||||||||||||||||||||||||||||
| 27 | { | ||||||||||||||||||||||||||||||
| 28 | 1 | ▶ | my( $self, $driver ) = @_; | ||||||||||||||||||||||||||||
|
Subroutine
generate_body: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||
| 30 | 1 | for(qw( repositoryName baseURL protocolVersion adminEmail earliestDatestamp deletedRecord granularity compression )) | |||||||||||||||||||||||||||||
| 31 | { | ||||||||||||||||||||||||||||||
| 32 | 8 | foreach my $value ($self->$_) | |||||||||||||||||||||||||||||
| 33 | { | ||||||||||||||||||||||||||||||
| 34 | 7 | $driver->data_element( $_, $value ); | |||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||
| 38 | 1 | for($self->description) { | |||||||||||||||||||||||||||||
| 39 | 2 | $_->generate( $driver ); | |||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||
| 43 | sub start_element { | ||||||||||||||||||||||||||||||
| 44 | 64 | ▶ | my ($self,$hash,$r) = @_; | ||||||||||||||||||||||||||||
|
Subroutine
start_element: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||
| 45 | 64 | my $elem = lc($hash->{LocalName}); | |||||||||||||||||||||||||||||
| 46 | 64 | ▶ | if( $elem eq 'description' && !$self->{"in_$elem"} ) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$elem eq "description" and not $$self{"in_$elem"}
MC/DC50%1/2
$elem eq "description" and not $$self{"in_$elem"}
$elem eq "description"
not $$self{"in_$elem"}
Truth table66%2/3
A and not(B)
A= $elem eq "description"B= not $$self{"in_$elem"}
| |||||||||||||||||||||||||||||||
| 47 | 4 | $self->set_handler(my $desc = HTTP::OAI::Metadata->new); | |||||||||||||||||||||||||||||
| 48 | 4 | $self->description([$self->description, $desc]); | |||||||||||||||||||||||||||||
| 49 | 4 | $self->{"in_$elem"} = $hash->{Depth}; | |||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||||
| 51 | 64 | $self->SUPER::start_element($hash,$r); | |||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||
| 54 | sub end_element { | ||||||||||||||||||||||||||||||
| 55 | 64 | ▶ | my ($self,$hash,$r) = @_; | ||||||||||||||||||||||||||||
|
Subroutine
end_element: called CC=13 SCAR=26.4
Pod
documented
| |||||||||||||||||||||||||||||||
| 56 | 64 | my $elem = $hash->{LocalName}; | |||||||||||||||||||||||||||||
| 57 | 64 | my $text = $hash->{Text}; | |||||||||||||||||||||||||||||
| 58 | 64 | ▶ | if( defined $text ) | ||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||
| 59 | { | ||||||||||||||||||||||||||||||
| 60 | 64 | $text =~ s/^\s+//; | |||||||||||||||||||||||||||||
| 61 | 64 | $text =~ s/\s+$//; | |||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||
| 63 | 64 | $self->SUPER::end_element($hash,$r); | |||||||||||||||||||||||||||||
| 64 | 64 | ▶ | if( defined($self->get_handler) ) { | ||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||
| 65 | 32 | ▶ | if( $elem eq 'description' && $self->{"in_$elem"} == $hash->{Depth} ) { | ||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$elem eq "description" and $$self{"in_$elem"} == $hash->{"Depth"}
MC/DC50%1/2
$elem eq "description" and $$self{"in_$elem"} == $hash->{"Depth"}
$elem eq "description"
$$self{"in_$elem"} == $hash->{"Depth"}
Truth table66%2/3
A and B
A= $elem eq "description"B= $$self{"in_$elem"} == $hash->{"Depth"}
| |||||||||||||||||||||||||||||||
| 66 | 4 | $self->set_handler( undef ); | |||||||||||||||||||||||||||||
| 67 | 4 | $self->{"in_$elem"} = 0; | |||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||
| 69 | } elsif( $elem eq 'adminEmail' ) { | ||||||||||||||||||||||||||||||
| 70 | 4 | $self->adminEmail($text); | |||||||||||||||||||||||||||||
| 71 | } elsif( $elem eq 'compression' ) { | ||||||||||||||||||||||||||||||
| 72 | 0 | $self->compression($text); | |||||||||||||||||||||||||||||
| 73 | } elsif( $elem eq 'baseURL' ) { | ||||||||||||||||||||||||||||||
| 74 | 4 | $self->baseURL($text); | |||||||||||||||||||||||||||||
| 75 | } elsif( $elem eq 'protocolVersion' ) { | ||||||||||||||||||||||||||||||
| 76 | 4 | ▶ | $text = '2.0' if $text =~ /\D/ or $text < 2.0; | ||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$text =~ /\D/ or $text < 2
MC/DC0%0/2
$text =~ /\D/ or $text < 2
$text =~ /\D/
$text < 2
Truth table33%1/3
A or B
A= $text =~ /\D/B= $text < 2
| |||||||||||||||||||||||||||||||
| 77 | 4 | $self->protocolVersion($text); | |||||||||||||||||||||||||||||
| 78 | ▶ | } elsif( defined($text) && length($text) ) { | |||||||||||||||||||||||||||||
|
Condition66%2/3
defined $text and length $text
MC/DC50%1/2
defined $text and length $text
defined $text
length $text
Truth table66%2/3
A and B
A= defined $textB= length $text
| |||||||||||||||||||||||||||||||
| 79 | 16 | $self->_elem($elem,$text); | |||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||
| 83 | 11 | 1; | |||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||
| 85 | __END__ | ||||||||||||||||||||||||||||||