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.49';
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 5 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
18 5 my $self = shift;
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 4 ▶override 'parse' => sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
29 4 my ($self, $raw) = @_;
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__
« Moose/Formater.pm ↑ Summary Moose/Formater/Yaml.pm »