Moose/Parser/MarcxmlSax.pm

filter: Statementstmt 100% 33 / 33 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 97.6% 42 / 43 CC 2 SCAR 2.0
CC
2
Cov
97%
__ANON__
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Moose/Formater.pm ↑ Summary Moose/Formater/Yaml.pm »
1 package MARC::Moose::Parser::MarcxmlSax;
2 # ABSTRACT: Parser for MARXML records using SAX parser
3 4 $MARC::Moose::Parser::MarcxmlSax::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 4 ▶use MARC::Moose::Field::Control;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 4 ▶use MARC::Moose::Field::Std;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 4 ▶use MARC::Moose::Parser::MarcxmlSaxHandler;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use XML::SAX qw(Namespaces Validation);;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use YAML;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14  
15 has parser => (
16 is => 'rw',
17 default => sub {
18 5 ▶ my $self = shift;
Subroutine __ANON__: called CC=1 SCAR=0.0
19 5 my $factory = XML::SAX::ParserFactory->new();
20 5 my $parser = $factory->parser(
21 Handler => MARC::Moose::Parser::MarcxmlSaxHandler->new(),
22 );
23 5 $self->parser( $parser );
24 },
25 4 );
26  
27  
28 override 'parse' => sub {
29 4 ▶ my ($self, $raw) = @_;
Subroutine __ANON__: called CC=2 SCAR=7.0
30  
31 4 ▶ return unless $raw;
Branch: 1 branch
BranchTrueFalseTotal
unless $raw 0 4 4
32  
33 4 $self->parser->parse_string( $raw );
34 4 my $record = $self->parser->{Handler}->{record};
35 4 return $record;
36 4 };
37  
38 4 __PACKAGE__->meta->make_immutable;
39  
40 4 1;
41  
42 __END__
43  
44 =pod
45  
46 =encoding UTF-8
47  
48 =head1 NAME
49  
50 MARC::Moose::Parser::MarcxmlSax - Parser for MARXML records using SAX parser
51  
52 =head1 VERSION
53  
54 version 1.0.46
55  
56 =head1 DESCRIPTION
57  
58 Parser for MARCXML records using SAX parser.
59  
60 =head1 SEE ALSO
61  
62 =over 4
63  
64 =item *
65  
66 L<MARC::Moose>
67  
68 =item *
69  
70 L<MARC::Moose::Parser>
71  
72 =item *
73  
74 L<MARC::Moose::Parser::Marcxml>
75  
76 =back
77  
78 =head1 AUTHOR
79  
80 Frédéric Demians <f.demians@tamil.fr>
81  
82 =head1 COPYRIGHT AND LICENSE
83  
84 This software is copyright (c) 2022 by Frédéric Demians.
85  
86 This is free software; you can redistribute it and/or modify it under
87 the same terms as the Perl 5 programming language system itself.
88  
89 =cut
« Moose/Formater.pm ↑ Summary Moose/Formater/Yaml.pm »