PICA/Writer/Plain.pm

filter: Statementstmt 96.3% 26 / 27 Branchbran 30.0% 3 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 5 totaltotal 74.5% 38 / 51 CC 6 SCAR 14.4
CC
6
Cov
78%
write_subfield
9.7
write_start_field
2.0
BEGIN
1.0
CRAP 4.2
« PICA/Writer/Generic.pm ↑ Summary PICA/Parser/PIXML.pm »
1 package PICA::Writer::Plain;
2 16 ▶use v5.14.1;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 16 our $VERSION = '2.12';
5  
6 16 ▶use charnames qw(:full);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 16 ▶use Term::ANSIColor;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 16 ▶use parent 'PICA::Writer::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 57 ▶sub SUBFIELD_INDICATOR {'$'}
Subroutine SUBFIELD_INDICATOR: called CC=1 SCAR=0.0
Pod undocumented
12 54 ▶sub END_OF_FIELD {"\n"}
Subroutine END_OF_FIELD: called CC=1 SCAR=0.0
Pod undocumented
13 39 ▶sub END_OF_RECORD {"\n"}
Subroutine END_OF_RECORD: called CC=1 SCAR=0.0
Pod undocumented
14  
15 57 ▶sub write_subfield {
Subroutine write_subfield: called CC=5 SCAR=22.7
Pod undocumented
16 57 my ($self, $code, $value) = @_;
17 57 $value =~ s/\$/\$\$/g;
18  
19 57 ▶ if (my $col = $self->{color}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $col = $self->{'color'}) { } 0 57 57
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 57 $value = $self->SUBFIELD_INDICATOR . $code . $value;
27 }
28  
29 57 $self->{fh}->print($value);
30 }
31  
32 54 ▶sub write_start_field {
Subroutine write_start_field: called CC=2 SCAR=6.9
Pod undocumented
33 54 my ($self, $field) = @_;
34  
35 54 my $annotation = $self->annotation($field);
36 54 ▶ $self->{fh}->print("$annotation ") if defined $annotation;
Branch: 1 branch
BranchTrueFalseTotal
if defined $annotation 12 42 54
37 54 $self->write_identifier($field);
38 54 $self->{fh}->print(' ');
39 }
40  
41 16 1;
42 __END__
« PICA/Writer/Generic.pm ↑ Summary PICA/Parser/PIXML.pm »