| 1 | package PICA::Writer::Fields; | ||||||||||||||||||||
| 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::Writer::Base'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | |||||||||||||||||||||
| 8 | 8 | ▶ | use Scalar::Util qw(reftype); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 8 | ▶ | use PICA::Schema qw(clean_pica field_identifier); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | sub write_record { | ||||||||||||||||||||
| 12 | 0 | ▶ | my ($self, $record) = @_; | ||||||||||||||||||
|
Subroutine
write_record: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||
| 13 | 0 | ▶ | $record = clean_pica($record) or return; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | 0 | my $fh = $self->{fh}; | |||||||||||||||||||
| 16 | 0 | ▶ | my $seen = $self->{seen} // ($self->{seen} = {}); | ||||||||||||||||||
|
Condition0%0/2
$self->{"seen"} // ($self->{"seen"} = {})
MC/DC0%0/1
$self->{"seen"} // ($self->{"seen"} = {})
$self->{"seen"}
Truth table0%0/2
A
A= $self->{"seen"}
| |||||||||||||||||||||
| 17 | 0 | my $schema = $self->{schema}; | |||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | 0 | foreach my $field (@$record) { | |||||||||||||||||||
| 20 | 0 | ▶ | my $id = field_identifier($schema ? $schema : (), $field); | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 0 | ▶ | next if $seen->{$id}; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 23 | 0 | $seen->{$id} = 1; | |||||||||||||||||||
| 24 | |||||||||||||||||||||
| 25 | 0 | $fh->print($id); | |||||||||||||||||||
| 26 | |||||||||||||||||||||
| 27 | 0 | ▶ | if ($schema) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 28 | 0 | my $def = $schema->{fields}{$id}; | |||||||||||||||||||
| 29 | 0 | ▶ | my $label = $def ? $def->{label} // '' : '?'; | ||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$def->{"label"} // ""
MC/DC0%0/1
$def->{"label"} // ""
$def->{"label"}
Truth table0%0/2
A
A= $def->{"label"}
| |||||||||||||||||||||
| 30 | 0 | $fh->print("\t" . $label =~ s/[\r\n]+/ /mgr); | |||||||||||||||||||
| 31 | } | ||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | 0 | $fh->print("\n"); | |||||||||||||||||||
| 34 | } | ||||||||||||||||||||
| 35 | } | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 8 | 1; | |||||||||||||||||||
| 38 | __END__ | ||||||||||||||||||||