Moose/Reader/File/Marcxml.pm

filter: Statementstmt 100% 27 / 27 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 94.7% 36 / 38 CC 3 SCAR 5.6
CC
3
Cov
97%
read
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.8
« Moose/Writer.pm ↑ Summary Moose/Parser.pm »
1 package MARC::Moose::Reader::File::Marcxml;
2 # ABSTRACT: File reader for MARCXML file
3 2 $MARC::Moose::Reader::File::Marcxml::VERSION = '1.0.49';
4 2 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use MARC::Moose::Record;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use MARC::Moose::Parser::Marcxml;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 with 'MARC::Moose::Reader::File';
11  
12  
13  
14 1 ▶has '+parser' => ( default => sub { MARC::Moose::Parser::MarcxmlSax->new() } );
Subroutine __ANON__: called CC=1 SCAR=0.0
15  
16  
17 5 ▶sub read {
Subroutine read: called CC=3 SCAR=11.0
Pod undocumented
18 5 my $self = shift;
19  
20 5 $self->count($self->count + 1);
21  
22 5 my $fh = $self->{fh};
23  
24 5 ▶ return if eof($fh);
Branch: 1 branch
BranchTrueFalseTotal
if eof $fh 0 5 5
25  
26 5 local $/ = "</record>"; # End of record
27 5 my $raw = <$fh>;
28
29 # Skip <collection if present
30 5 $raw =~ s/<(\/*)collection.*>//;
31  
32 # End of file
33 5 ▶ return unless $raw =~ /<record.*>/;
Branch: 1 branch
BranchTrueFalseTotal
unless $raw =~ /<record.*>/ 1 4 5
34  
35 4 $self->parser->parse( $raw );
36 }
37  
38 2 __PACKAGE__->meta->make_immutable;
39  
40 2 1;
41  
42 __END__
« Moose/Writer.pm ↑ Summary Moose/Parser.pm »