File Coverage

blib/lib/MARC/Validator/Filter/Plugin/AACR2.pm
Criterion Covered Total %
statement 26 26 100.0
branch 4 4 100.0
condition n/a
subroutine 7 7 100.0
pod 2 2 100.0
total 39 39 100.0


line stmt bran cond sub pod time code
1             package MARC::Validator::Filter::Plugin::AACR2;
2              
3 5     5   421741 use base qw(MARC::Validator::Filter::Abstract);
  5         12  
  5         3115  
4 5     5   36 use strict;
  5         11  
  5         120  
5 5     5   22 use warnings;
  5         14  
  5         344  
6              
7 5     5   29 use English;
  5         12  
  5         35  
8 5     5   6287 use MARC::Leader 0.08;
  5         63934  
  5         932  
9              
10             our $VERSION = 0.01;
11              
12             sub name {
13 1     1 1 8 my $self = shift;
14              
15 1         8 return 'aacr2';
16             }
17              
18             sub process {
19 3     3 1 20461 my ($self, $marc_record) = @_;
20              
21 3         16 my $leader_string = $marc_record->leader;
22 3         31 my $leader = eval {
23             MARC::Leader->new(
24 3         46 'verbose' => $self->{'verbose'},
25             )->parse($leader_string);
26             };
27 3 100       18803 if ($EVAL_ERROR) {
28 1         6 return;
29             }
30 2 100       11 if ($leader->descriptive_cataloging_form ne 'a') {
31 1         48 return;
32             }
33              
34 1         21 return 'aacr2';
35             }
36              
37             1;
38              
39             __END__