| 1 | package PICA::Writer::Generic; | ||
| 2 | use v5.14.1; | ||
| 3 | |||
| 4 | our $VERSION = '1.18'; | ||
| 5 | |||
| 6 | use charnames qw(:full); | ||
| 7 | |||
| 8 | use parent 'PICA::Writer::Base'; | ||
| 9 | |||
| 10 | sub SUBFIELD_INDICATOR { | ||
| 11 | my $self = shift; | ||
| 12 | return | ||
| 13 | exists $self->{us} ? "$self->{us}" : "\N{INFORMATION SEPARATOR ONE}"; | ||
| 14 | } | ||
| 15 | |||
| 16 | sub END_OF_FIELD { | ||
| 17 | my $self = shift; | ||
| 18 | return | ||
| 19 | exists $self->{rs} ? "$self->{rs}" : "\N{INFORMATION SEPARATOR TWO}"; | ||
| 20 | } | ||
| 21 | |||
| 22 | sub END_OF_RECORD { | ||
| 23 | my $self = shift; | ||
| 24 | return | ||
| 25 | exists $self->{gs} | ||
| 26 | ? "$self->{gs}" | ||
| 27 | : "\N{INFORMATION SEPARATOR THREE}"; | ||
| 28 | } | ||
| 29 | |||
| 30 | sub write_subfield { | ||
| 31 | my ($self, $code, $value) = @_; | ||
| 32 | $self->{fh}->print($self->SUBFIELD_INDICATOR . $code . $value); | ||
| 33 | } | ||
| 34 | |||
| 35 | 1; | ||
| 36 | __END__ |