blib/lib/PICA/Writer/Plain.pm

filter: Statementstmt 92.3% 24 / 26 Branchbran 35.7% 5 / 14 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 5 totaltotal 66.1% 39 / 59 CC 9 SCAR 16.4
CC
9
Cov
70%
write_subfield
9.7
write_annotation
6.4
BEGIN
1.0
CRAP 5.1
« blib/lib/PICA/Error.pm ↑ Summary blib/lib/PICA/Parser/PPXML.pm »
1 package PICA::Writer::Plain;
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 charnames qw(:full);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 8 ▶use Term::ANSIColor;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 8 ▶use parent 'PICA::Writer::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 7 ▶sub SUBFIELD_INDICATOR {'$'}
Subroutine SUBFIELD_INDICATOR: called CC=1 SCAR=0.0
Pod undocumented
12 7 ▶sub END_OF_FIELD {"\n"}
Subroutine END_OF_FIELD: called CC=1 SCAR=0.0
Pod undocumented
13 7 ▶sub END_OF_RECORD {"\n"}
Subroutine END_OF_RECORD: called CC=1 SCAR=0.0
Pod undocumented
14  
15 sub write_subfield {
16 7 ▶ my ($self, $code, $value) = @_;
Subroutine write_subfield: called CC=5 SCAR=22.7
Pod undocumented
17 7 $value =~ s/\$/\$\$/g;
18  
19 7 ▶ if (my $col = $self->{color}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $col = $self->{'color'}) { } 0 7 7
20 $value
21 = ($col->{syntax} ? colored('$', $col->{syntax}) : '$')
22 . ($col->{code} ? colored($code, $col->{code}) : $code)
23 0 ▶ . ($col->{value} ? colored($value, $col->{value}) : $value);
Branch: 3 branches
BranchTrueFalseTotal
$col->{'syntax'} ? : 0 0 0
$col->{'code'} ? : 0 0 0
$col->{'value'} ? : 0 0 0
24 }
25 else {
26 7 $value = $self->SUBFIELD_INDICATOR . $code . $value;
27 }
28  
29 7 $self->{fh}->print($value);
30 }
31  
32 sub write_annotation {
33 7 ▶ my ($self, $field) = @_;
Subroutine write_annotation: called CC=5 SCAR=18.6
Pod undocumented
34  
35 7 ▶ if (@$field % 2) {
Branch: 2 branches
BranchTrueFalseTotal
if (@$field % 2) { } 4 3 7
elsif ($self->{'annotated'}) { } 0 3 3
36 $self->{fh}->print($field->[$#$field] . " ")
37 4 ▶ unless defined $self->{annotated} && !$self->{annotated};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"annotated"} and not $self->{"annotated"} 4 0 4
Condition33%1/3
defined $self->{"annotated"} and not $self->{"annotated"}
!ll&&!rl&&r
400
MC/DC0%0/2
defined $self->{"annotated"} and not $self->{"annotated"}
defined $self->{"annotated"} not $self->{"annotated"}
Truth table33%1/3
A and not(B)
A= defined $self->{"annotated"}B= not $self->{"annotated"}
ABresult
0X0
100
111
38 }
39 elsif ($self->{annotated}) {
40 0 $self->{fh}->print(" ");
41 }
42 }
43  
44 8 1;
45 __END__
« blib/lib/PICA/Error.pm ↑ Summary blib/lib/PICA/Parser/PPXML.pm »