Filter/Plugin/Material.pm

filter: Statementstmt 100% 3 / 3 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 1 / 1 Podpod n/a totaltotal 100% 4 / 4 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
CRAP 1.0
« Filter/Plugin/AACR2.pm ↑ Summary Filter/Plugin/RDA.pm »
1 package MARC::Validator::Filter::Plugin::Material;
2  
3 3 ▶use base qw(MARC::Validator::Filter::Abstract);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 use strict;
5 use warnings;
6  
7 use English;
8 use MARC::Leader 0.08;
9 use MARC::Leader::Utils 0.02 qw(material_type);
10  
11 our $VERSION = 0.01;
12  
13 sub name {
14 my $self = shift;
15  
16 return 'material';
17 }
18  
19 sub process {
20 my ($self, $marc_record) = @_;
21  
22 my $leader_string = $marc_record->leader;
23 my $leader = eval {
24 MARC::Leader->new(
25 'verbose' => $self->{'verbose'},
26 )->parse($leader_string);
27 };
28 if ($EVAL_ERROR) {
29 return;
30 }
31 my $material_type = material_type($leader);
32  
33 return 'material_'.$material_type;
34 }
35  
36 1;
37  
38 __END__
« Filter/Plugin/AACR2.pm ↑ Summary Filter/Plugin/RDA.pm »