| 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
| |||||||||||||||||||
| 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
| |||||||||||||||||||
| 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
| |||||||||||||||||||
| 37 | 54 | $self->write_identifier($field); | |||||||||||||||||
| 38 | 54 | $self->{fh}->print(' '); | |||||||||||||||||
| 39 | } | ||||||||||||||||||
| 40 | |||||||||||||||||||
| 41 | 16 | 1; | |||||||||||||||||
| 42 | __END__ | ||||||||||||||||||