| 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)
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)
| |||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||
| 41 | { | ||||||||||||||||||||||||||||||||||||
| 42 | 32 | my $elem = lc($hash->{LocalName}); | |||||||||||||||||||||||||||||||||||
| 43 | 32 | ▶ | if( $elem eq 'record' && $hash->{Attributes}->{'{}status'}->{Value} ) | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition66%2/3
$elem eq "record" and $hash->{"Attributes"}{"{}status"}{"Value"}
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"}
| |||||||||||||||||||||||||||||||||||||
| 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'
MC/DC100%1/1
$r->handlers->{$elem} || 'HTTP::OAI::Metadata'
$r->handlers->{$elem}
Truth table100%2/2
A
A= $r->handlers->{$elem}
| |||||||||||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||||||||||
| 71 | { | ||||||||||||||||||||||||||||||||||||
| 72 | 22 | $self->set_handler( undef ); | |||||||||||||||||||||||||||||||||||
| 73 | 22 | $self->{in_record} = 0; | |||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||
| 77 | 11 | 1; | |||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||
| 79 | __END__ | ||||||||||||||||||||||||||||||||||||