lib/HTTP/OAI/Record.pm

filter: Statementstmt 95.0% 38 / 40 Branchbran 83.3% 10 / 12 Conditioncond 62.5% 5 / 8 MC/DCmcdc 20.0% 1 / 5 Subroutinesub 91.6% 11 / 12 Podpod 63.6% 7 / 11 totaltotal 81.8% 72 / 88 CC 11 SCAR 12.4
CC
11
Cov
88%
start_element
7.1
generate
3.0
new
2.1
CRAP 3.4
« lib/HTTP/OAI/MetadataFormat.pm ↑ Summary lib/HTTP/OAI/MemberMixin.pm »
1 package HTTP::OAI::Record;
2  
3 11 @ISA = qw( HTTP::OAI::MemberMixin HTTP::OAI::SAX::Base );
4  
5 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 11 our $VERSION = '4.13';
8  
9 11 ▶sub new {
Subroutine new: called CC=2 SCAR=7.6
Pod documented
10 11 my ($class,%args) = @_;
11  
12 11 ▶ $args{header} ||= HTTP::OAI::Header->new(%args);
Condition33%1/3
$args{"header"} ||= "HTTP::OAI::Header"->new(%args)
l!l&&r!l&&!r
0110
MC/DC0%0/2
$args{"header"} ||= "HTTP::OAI::Header"->new(%args)
$args{"header"} "HTTP::OAI::Header"->new(%args)
Truth table33%1/3
A ||= B
A= $args{"header"}B= "HTTP::OAI::Header"->new(%args)
ABresult
1X1
011
000
13  
14 11 return $class->SUPER::new(%args);
15 }
16  
17 35 ▶sub header { shift->_elem('header',@_) }
Subroutine header: called CC=1 SCAR=0.0
Pod undocumented
18 18 ▶sub metadata { shift->_elem('metadata',@_) }
Subroutine metadata: called CC=1 SCAR=0.0
Pod undocumented
19 3 ▶sub about { shift->_multi('about',@_) }
Subroutine about: called CC=1 SCAR=0.0
Pod undocumented
20  
21 18 ▶sub identifier { shift->header->identifier(@_) }
Subroutine identifier: called CC=1 SCAR=0.0
Pod documented
22 1 ▶sub datestamp { shift->header->datestamp(@_) }
Subroutine datestamp: called CC=1 SCAR=0.0
Pod documented
23 1 ▶sub status { shift->header->status(@_) }
Subroutine status: called CC=1 SCAR=0.0
Pod documented
24 0 ▶sub is_deleted { shift->header->is_deleted(@_) }
Subroutine is_deleted: not called CC=1 SCAR=6.9
Pod documented
25  
26 sub generate
27 1 ▶{
Subroutine generate: called CC=3 SCAR=11.0
Pod undocumented
28 1 my( $self, $driver ) = @_;
29  
30 1 $driver->start_element('record');
31 1 $self->header->generate( $driver );
32 1 ▶ $self->metadata->generate( $driver ) if defined $self->metadata;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->metadata 1 0 1
33 1 $self->about->generate( $driver ) for $self->about;
34 1 $driver->end_element('record');
35 }
36  
37 197 ▶sub start_element {
Subroutine start_element: called CC=7 SCAR=19.6
Pod documented
38 197 my ($self,$hash, $r) = @_;
39  
40 197 ▶ if( !$self->{in_record} )
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"in_record"}) 32 165 197
41 {
42 32 my $elem = lc($hash->{LocalName});
43 32 ▶ if( $elem eq 'record' && $hash->{Attributes}->{'{}status'}->{Value} )
Branch: 3 branches
BranchTrueFalseTotal
if ($elem eq 'record' and $hash->{'Attributes'}{'{}status'}{'Value'}) { } 0 32 32
elsif ($elem eq 'header') { } 10 22 32
elsif ($elem =~ /^metadata|about$/) { } 12 10 22
Condition66%2/3
$elem eq "record" and $hash->{"Attributes"}{"{}status"}{"Value"}
!ll&&!rl&&r
22100
MC/DC0%0/2
$elem eq "record" and $hash->{"Attributes"}{"{}status"}{"Value"}
$elem eq "record" $hash->{"Attributes"}{"{}status"}{"Value"}
Truth table66%2/3
A and B
A= $elem eq "record"B= $hash->{"Attributes"}{"{}status"}{"Value"}
ABresult
0X0
100
111
44 {
45 0 $self->status($hash->{Attributes}->{'{}status'}->{Value});
46 }
47 elsif( $elem eq "header" )
48 {
49 10 $self->set_handler(my $handler = HTTP::OAI::Header->new);
50 10 $self->header( $handler );
51 10 $self->{in_record} = $hash->{Depth};
52 }
53 elsif( $elem =~ /^metadata|about$/ )
54 {
55 12 ▶ my $class = $r->handlers->{$elem} || "HTTP::OAI::Metadata";
Condition100%2/2
$r->handlers->{$elem} || 'HTTP::OAI::Metadata'
l!l
39
MC/DC100%1/1
$r->handlers->{$elem} || 'HTTP::OAI::Metadata'
$r->handlers->{$elem}
Truth table100%2/2
A
A= $r->handlers->{$elem}
Aresult
11
00
56 12 $self->set_handler(my $handler = $class->new);
57 12 $self->$elem($handler);
58 12 $self->{in_record} = $hash->{Depth};
59 }
60 }
61  
62 197 $self->SUPER::start_element($hash, $r);
63 }
64  
65 197 ▶sub end_element {
Subroutine end_element: called CC=2 SCAR=6.9
Pod documented
66 197 my ($self,$hash, $r) = @_;
67  
68 197 $self->SUPER::end_element($hash, $r);
69  
70 197 ▶ if( $self->{in_record} == $hash->{Depth} )
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"in_record"} == $hash->{"Depth"}) 22 175 197
71 {
72 22 $self->set_handler( undef );
73 22 $self->{in_record} = 0;
74 }
75 }
76  
77 11 1;
78  
79 __END__
« lib/HTTP/OAI/MetadataFormat.pm ↑ Summary lib/HTTP/OAI/MemberMixin.pm »