blib/lib/HTTP/OAI/Identify.pm

filter: Statementstmt 92.1% 47 / 51 Branchbran 85.0% 17 / 20 Conditioncond 58.3% 7 / 12 MC/DCmcdc 37.5% 3 / 8 Subroutinesub 93.3% 14 / 15 Podpod 84.6% 11 / 13 totaltotal 83.1% 99 / 119 CC 18 SCAR 19.3
CC
18
Cov
86%
end_element
14.0
generate_body
4.0
start_element
3.0
CRAP 6.9
« blib/lib/HTTP/OAI/Metadata/OAI_DC.pm ↑ Summary blib/script/oai_pmh.pl »
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
BranchTrueFalseTotal
if ($elem eq "description" and not $$self{"in_$elem"}) 4 60 64
Condition66%2/3
$elem eq "description" and not $$self{"in_$elem"}
!ll&&!rl&&r
6004
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"}
ABresult
0X0
100
111
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
BranchTrueFalseTotal
if (defined $text) 64 0 64
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
BranchTrueFalseTotal
if (defined $self->get_handler) { } 32 32 64
elsif ($elem eq 'adminEmail') { } 4 28 32
elsif ($elem eq 'compression') { } 0 28 28
elsif ($elem eq 'baseURL') { } 4 24 28
elsif ($elem eq 'protocolVersion') { } 4 20 24
elsif (defined $text and length $text) { } 16 4 20
65 32 ▶ if( $elem eq 'description' && $self->{"in_$elem"} == $hash->{Depth} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($elem eq "description" and $$self{"in_$elem"} == $hash->{"Depth"}) 4 28 32
Condition66%2/3
$elem eq "description" and $$self{"in_$elem"} == $hash->{"Depth"}
!ll&&!rl&&r
2804
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"}
ABresult
0X0
100
111
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
BranchTrueFalseTotal
if $text =~ /\D/ or $text < 2 4 0 4
Condition33%1/3
$text =~ /\D/ or $text < 2
l!l&&r!l&&!r
400
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
ABresult
1X1
011
000
77 4 $self->protocolVersion($text);
78 ▶ } elsif( defined($text) && length($text) ) {
Condition66%2/3
defined $text and length $text
!ll&&!rl&&r
0416
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
ABresult
0X0
100
111
79 16 $self->_elem($elem,$text);
80 }
81 }
82  
83 11 1;
84  
85 __END__
« blib/lib/HTTP/OAI/Metadata/OAI_DC.pm ↑ Summary blib/script/oai_pmh.pl »