blib/lib/PICA/Parser/PPXML.pm

filter: Statementstmt 100% 23 / 23 Branchbran 100% 4 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 93.9% 31 / 33 CC 6 SCAR 15.6
CC
6
Cov
97%
_next_record
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.8
« blib/lib/PICA/Writer/Plain.pm ↑ Summary blib/lib/PICA/Parser/Plus.pm »
1 package PICA::Parser::PPXML;
2 8 ▶use v5.14.1;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 8 our $VERSION = '1.18';
5  
6 8 ▶use parent 'PICA::Parser::XML';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 sub _next_record {
9 5 ▶ my ($self) = @_;
Subroutine _next_record: called CC=6 SCAR=17.9
10  
11 5 my $reader = $self->{xml_reader};
12 return
13 5 ▶ unless $reader->nextElement('record',
Branch: 1 branch
BranchTrueFalseTotal
unless $reader->nextElement("record", "http://www.oclcpica.org/xmlns/ppxml-1.0") 1 4 5
14 'http://www.oclcpica.org/xmlns/ppxml-1.0');
15  
16 4 my @record;
17  
18 # get all field from PICA record;
19 4 foreach
20 my $field ($reader->copyCurrentNode(1)->getElementsByLocalName('tag'))
21 {
22 55 my @field;
23  
24 # get field tag number
25 55 my $tag = $field->getAttribute('id');
26 55 ▶ my $occ = $field->getAttribute('occ') // '';
Condition50%1/2
$field->getAttribute("occ") // ""
l!l
550
MC/DC0%0/1
$field->getAttribute("occ") // ""
$field->getAttribute("occ")
Truth table50%1/2
A
A= $field->getAttribute("occ")
Aresult
11
00
27 55 ▶ $occ = sprintf '%02d', $occ if $occ ne '';
Branch: 1 branch
BranchTrueFalseTotal
if $occ ne "" 21 34 55
28 55 push(@field, ($tag, $occ));
29  
30 # get all subfields
31 55 foreach my $subfield ($field->getElementsByLocalName('subf')) {
32 118 my $subfield_code = $subfield->getAttribute('id');
33 118 my $subfield_data = $subfield->textContent;
34 118 push(@field, ($subfield_code, $subfield_data));
35 }
36 55 push(@record, [@field]);
37 }
38  
39 4 return \@record;
40 }
41  
42 8 1;
43 __END__
« blib/lib/PICA/Writer/Plain.pm ↑ Summary blib/lib/PICA/Parser/Plus.pm »