line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::Condition::marc_match; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
116918
|
use Moo; |
|
3
|
|
|
|
|
7444
|
|
|
3
|
|
|
|
|
16
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.20'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
extends 'Catmandu::Fix::Condition::marc_all_match'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Catmandu::Fix::Condition::marc_match - Test if a MARC (sub)field matches a value |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# marc_match(MARC_PATH,REGEX) |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Match when 245 contains the value "My funny title" |
18
|
|
|
|
|
|
|
if marc_match('245','My funny title') |
19
|
|
|
|
|
|
|
add_field('my.funny.title','true') |
20
|
|
|
|
|
|
|
end |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Match when 245a contains the value "My funny title" |
23
|
|
|
|
|
|
|
if marc_match('245a','My funny title') |
24
|
|
|
|
|
|
|
add_field('my.funny.title','true') |
25
|
|
|
|
|
|
|
end |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Match when all 650 fields contain digits |
28
|
|
|
|
|
|
|
if marc_match('650','[0-9]') |
29
|
|
|
|
|
|
|
add_field('has_digits','true') |
30
|
|
|
|
|
|
|
end |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# Match when /one/ of the 650 fields contain digits |
33
|
|
|
|
|
|
|
do marc_each() |
34
|
|
|
|
|
|
|
if marc_all_match('650','[0-9]') |
35
|
|
|
|
|
|
|
add_field('has_digits','true') |
36
|
|
|
|
|
|
|
end |
37
|
|
|
|
|
|
|
end |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 DESCRIPTION |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Evaluate the enclosing fixes only if the MARC (sub)field matches a |
42
|
|
|
|
|
|
|
regular expression. When the MARC field is a repeated fiels, then all |
43
|
|
|
|
|
|
|
the MARC fields should match the regular expression. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
DEPRECATED: This condition is the same as L<Catmandu::Fix::Condition::marc_all_match> |
46
|
|
|
|
|
|
|
and will be deleted in the future |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=head1 METHODS |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 marc_match(MARC_PATH, REGEX) |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Evaluates to true when all MARC_PATH values matches the REGEX, false otherwise. |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head1 SEE ALSO |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
L<Catmandu::Fix::Condition::marc_all_match>, |
57
|
|
|
|
|
|
|
L<Catmandu::Fix::Condition::marc_any_match>, |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |