Moose/Parser/Legacy.pm

filter: Statementstmt 42.1% 8 / 19 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 1 / 2 Podpod n/a totaltotal 33.3% 9 / 27 CC 5 SCAR 32.3
CC
5
Cov
32%
__ANON__
30.0
BEGIN
1.0
CRAP 25.2
« Moose/Parser/Json.pm ↑ Summary Moose/Parser/Marcxml.pm »
1 package MARC::Moose::Parser::Legacy;
2 # ABSTRACT: Parser for MARC::Record legacy records
3 4 $MARC::Moose::Parser::Legacy::VERSION = '1.0.46';
4 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 extends 'MARC::Moose::Parser';
7  
8  
9  
10 override 'parse' => sub {
11 0 ▶ my ($self, $legacy) = @_;
Subroutine __ANON__: not called CC=5 SCAR=34.0
12  
13 0 ▶ return unless $legacy;
Branch: 1 branch
BranchTrueFalseTotal
unless $legacy 0 0 0
14  
15 0 my $record = MARC::Moose::Record->new();
16 0 $record->_leader( $legacy->leader );
17 0 my @fields;
18 0 for my $field ( $legacy->fields() ) {
19 0 my $tag = $field->tag;
20 0 ▶ push @fields, $tag < '010'
Branch: 1 branch
BranchTrueFalseTotal
$tag < '010' ? : 0 0 0
21 ? MARC::Moose::Field::Control->new(
22 tag => $tag,
23 value => $field->data )
24 : MARC::Moose::Field::Std->new(
25 tag => $tag,
26 ind1 => $field->indicator(1),
27 ind2 => $field->indicator(2),
28 subf => [ $field->subfields() ] )
29 }
30 0 $record->fields( \@fields );
31 0 ▶ $record->lint($self->lint) if $self->lint;
Branch: 1 branch
BranchTrueFalseTotal
if $self->lint 0 0 0
32 0 return $record;
33 4 };
34  
35 4 __PACKAGE__->meta->make_immutable;
36  
37 4 1;
38  
39 __END__
40  
41 =pod
42  
43 =encoding UTF-8
44  
45 =head1 NAME
46  
47 MARC::Moose::Parser::Legacy - Parser for MARC::Record legacy records
48  
49 =head1 VERSION
50  
51 version 1.0.46
52  
53 =head1 SYNOPSYS
54  
55 # Get a MARC::Record
56 my $legacy_record = GetMarcBiblio(100);
57 my $parser = MARC::Moose::Parser::Legacy->new();
58 # Transform it into MARC::Moose::Record
59 my $record = $parser->parse($legacy_record);
60  
61 =head1 SEE ALSO
62 =for :list
63 * L<MARC::Moose>
64 * L<MARC::Moose::Parser>
65 * L<MARC::Record>
66  
67 =head1 AUTHOR
68  
69 Frédéric Demians <f.demians@tamil.fr>
70  
71 =head1 COPYRIGHT AND LICENSE
72  
73 This software is copyright (c) 2022 by Frédéric Demians.
74  
75 This is free software; you can redistribute it and/or modify it under
76 the same terms as the Perl 5 programming language system itself.
77  
78 =cut
« Moose/Parser/Json.pm ↑ Summary Moose/Parser/Marcxml.pm »