| 1 | package MARC::Validator::Plugin::Field080; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use base qw(MARC::Validator::Abstract); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 6 | ▶ | use Business::UDC 0.10; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use Data::MARC::Validator::Report::Error 0.02; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 6 | ▶ | use Data::MARC::Validator::Report::Plugin::Errors 0.02; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 6 | our $VERSION = 0.24; | |||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | 20 | ▶ | sub module_name { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
module_name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 20 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 20 | return __PACKAGE__; | |||||||||||||||||||||||||||||||||||||||||||||
| 17 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 21 | ▶ | sub name { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 21 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 21 | return 'field_080'; | |||||||||||||||||||||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 18 | ▶ | sub process { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
process: called CC=14 SCAR=26.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 18 | my ($self, $marc_record) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 18 | my $record_id = $self->{'cb_record_id'}->($marc_record); | |||||||||||||||||||||||||||||||||||||||||||||
| 29 | 18 | my @record_errors; | |||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 18 | my @field_080 = $marc_record->field('080'); | |||||||||||||||||||||||||||||||||||||||||||||
| 32 | 18 | foreach my $field_080 (@field_080) { | |||||||||||||||||||||||||||||||||||||||||||||
| 33 | 67 | my $field_080a = $field_080->subfield('a'); | |||||||||||||||||||||||||||||||||||||||||||||
| 34 | 67 | my $udc = Business::UDC->new($field_080a); | |||||||||||||||||||||||||||||||||||||||||||||
| 35 | 67 | ▶ | if (! $udc->is_valid) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 36 | 20 | my ($udc_error, %udc_error_params) = $udc->error; | |||||||||||||||||||||||||||||||||||||||||||||
| 37 | 20 | ▶ | if ($udc_error eq 'Alphabetical specification cannot appear standalone.') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 10 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 38 | push @record_errors, Data::MARC::Validator::Report::Error->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 'error' => "Field 080a has name standalone.", | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 'params' => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | 'field_080_a' => $field_080a, | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 1 | 'position' => $udc_error_params{'position'}, | |||||||||||||||||||||||||||||||||||||||||||||
| 43 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 44 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 45 | } elsif ($udc_error eq 'Whitespace is not allowed in UDC string.') { | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | push @record_errors, Data::MARC::Validator::Report::Error->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 'error' => "Field 080a has trailing space.", | ||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 'params' => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 49 | 'field_080_a' => $field_080a, | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 3 | 'position' => $udc_error_params{'position'}, | |||||||||||||||||||||||||||||||||||||||||||||
| 51 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 52 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 53 | } elsif ($udc_error eq 'Bad apostrophe character.') { | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | push @record_errors, Data::MARC::Validator::Report::Error->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 55 | 'error' => "Field 080a has bad apostrophe character.", | ||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 'params' => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 'field_080_a' => $field_080a, | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | 'character' => $udc_error_params{'character'}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | 6 | 'position' => $udc_error_params{'position'}, | |||||||||||||||||||||||||||||||||||||||||||||
| 60 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } elsif ($udc_error eq 'Bad quotation mark character.') { | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | push @record_errors, Data::MARC::Validator::Report::Error->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 'error' => "Field 080a has bad quotation mark character.", | ||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 'params' => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 'field_080_a' => $field_080a, | ||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 'character' => $udc_error_params{'character'}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 4 | 'position' => $udc_error_params{'position'}, | |||||||||||||||||||||||||||||||||||||||||||||
| 69 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 70 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 71 | } elsif ($udc_error eq 'Bad dot character in number.') { | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | push @record_errors, Data::MARC::Validator::Report::Error->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 'error' => "Field 080a has bad dot character.", | ||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 'params' => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 'field_080_a' => $field_080a, | ||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 'character' => $udc_error_params{'character'}, | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 1 | 'position' => $udc_error_params{'position'}, | |||||||||||||||||||||||||||||||||||||||||||||
| 78 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } elsif ($udc_error eq "Missing opening parenthesis '('.") { | ||||||||||||||||||||||||||||||||||||||||||||||
| 81 | push @record_errors, Data::MARC::Validator::Report::Error->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 'error' => "Field 080a has missing opening parenthesis '('.", | ||||||||||||||||||||||||||||||||||||||||||||||
| 83 | 'params' => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 'field_080_a' => $field_080a, | ||||||||||||||||||||||||||||||||||||||||||||||
| 85 | 1 | 'position' => $udc_error_params{'position'}, | |||||||||||||||||||||||||||||||||||||||||||||
| 86 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 87 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 88 | } elsif ($udc_error eq "Missing closing parenthesis ')'.") { | ||||||||||||||||||||||||||||||||||||||||||||||
| 89 | push @record_errors, Data::MARC::Validator::Report::Error->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 'error' => "Field 080a has missing closing parenthesis ')'.", | ||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 'params' => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 'field_080_a' => $field_080a, | ||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 1 | 'position' => $udc_error_params{'position'}, | |||||||||||||||||||||||||||||||||||||||||||||
| 94 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 95 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 96 | } elsif ($udc_error eq "Extra closing parenthesis ')'.") { | ||||||||||||||||||||||||||||||||||||||||||||||
| 97 | push @record_errors, Data::MARC::Validator::Report::Error->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 'error' => "Field 080a has extra closing parenthesis ')'.", | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 'params' => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 'field_080_a' => $field_080a, | ||||||||||||||||||||||||||||||||||||||||||||||
| 101 | 1 | 'position' => $udc_error_params{'position'}, | |||||||||||||||||||||||||||||||||||||||||||||
| 102 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 103 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 104 | } elsif ($udc_error eq "Missing closing quotation mark '\"'.") { | ||||||||||||||||||||||||||||||||||||||||||||||
| 105 | push @record_errors, Data::MARC::Validator::Report::Error->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 'error' => "Field 080a has missing closing quotation mark '\"'.", | ||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 'params' => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 'field_080_a' => $field_080a, | ||||||||||||||||||||||||||||||||||||||||||||||
| 109 | 1 | 'position' => $udc_error_params{'position'}, | |||||||||||||||||||||||||||||||||||||||||||||
| 110 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 111 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 112 | } elsif ($udc_error eq "Extra opening parenthesis '('.") { | ||||||||||||||||||||||||||||||||||||||||||||||
| 113 | push @record_errors, Data::MARC::Validator::Report::Error->new( | ||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 'error' => "Field 080a has extra opening parenthesis '('.", | ||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 'params' => { | ||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 'field_080_a' => $field_080a, | ||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 1 | 'position' => $udc_error_params{'position'}, | |||||||||||||||||||||||||||||||||||||||||||||
| 118 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 119 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 18 | ▶ | if (@record_errors) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 125 | 18 | push @{$self->{'errors'}}, Data::MARC::Validator::Report::Plugin::Errors->new( | |||||||||||||||||||||||||||||||||||||||||||||
| 126 | 'errors' => \@record_errors, | ||||||||||||||||||||||||||||||||||||||||||||||
| 127 | 18 | 'filters' => $self->{'filters'}, | |||||||||||||||||||||||||||||||||||||||||||||
| 128 | 'record_id' => $record_id, | ||||||||||||||||||||||||||||||||||||||||||||||
| 129 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||||||
| 132 | 18 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 133 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||||||||||||||||||||
| 135 | 20 | ▶ | sub version { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
version: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 20 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||||||
| 138 | 20 | return $VERSION; | |||||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 6 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||
| 143 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||