line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::Condition::marc_spec_has; |
2
|
1
|
|
|
1
|
|
811
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
3
|
1
|
|
|
1
|
|
568
|
use Catmandu::Fix::marc_spec; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
5
|
|
4
|
1
|
|
|
1
|
|
466
|
use Catmandu::Fix::Condition::exists; |
|
1
|
|
|
|
|
9865
|
|
|
1
|
|
|
|
|
5
|
|
5
|
1
|
|
|
1
|
|
493
|
use Catmandu::Fix::set_field; |
|
1
|
|
|
|
|
4874
|
|
|
1
|
|
|
|
|
5
|
|
6
|
1
|
|
|
1
|
|
490
|
use Catmandu::Fix::remove_field; |
|
1
|
|
|
|
|
3958
|
|
|
1
|
|
|
|
|
6
|
|
7
|
1
|
|
|
1
|
|
72
|
use Moo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
8
|
1
|
|
|
1
|
|
322
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.12'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'Catmandu::Fix::Condition'; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has marc_spec => (fix_arg => 1); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub emit { |
17
|
2
|
|
|
2
|
0
|
19733
|
my ($self,$fixer,$label) = @_; |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
|
|
5
|
my $perl; |
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
|
|
59
|
my $tmp_var = '_tmp_' . int(rand(9999)); |
22
|
2
|
|
|
|
|
32
|
my $marc_spec = Catmandu::Fix::marc_spec->new($self->marc_spec , "$tmp_var.\$append"); |
23
|
2
|
|
|
|
|
1846
|
$perl .= $marc_spec->emit($fixer,$label); |
24
|
|
|
|
|
|
|
|
25
|
2
|
|
|
|
|
29
|
my $all_match = Catmandu::Fix::Condition::exists->new("$tmp_var"); |
26
|
2
|
|
|
|
|
1927
|
my $remove_field = Catmandu::Fix::remove_field->new($tmp_var); |
27
|
|
|
|
|
|
|
|
28
|
2
|
|
|
|
|
1116
|
my $pass_fixes = $self->pass_fixes; |
29
|
2
|
|
|
|
|
8
|
my $fail_fixes = $self->fail_fixes; |
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
9
|
$all_match->pass_fixes([ $remove_field , @$pass_fixes ]); |
32
|
2
|
|
|
|
|
5
|
$all_match->fail_fixes([ $remove_field , @$fail_fixes ]); |
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
9
|
$perl .= $all_match->emit($fixer,$label); |
35
|
|
|
|
|
|
|
|
36
|
2
|
|
|
|
|
1227
|
$perl; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Catmandu::Fix::Condition::marc_spec_has - Test if a MARCspec references data |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 SYNOPSIS |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# marc_spec_has(MARCspec) |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
unless marc_spec_has('LDR{/6=\a}{/7=\a|/7=\c|/7=\d|/7=\m}') |
48
|
|
|
|
|
|
|
set_field('type','Book') |
49
|
|
|
|
|
|
|
end |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head1 DESCRIPTION |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Evaluate the enclosing fixes only if the MARCspec does reference data. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
Does the same like L<marc_has|Catmandu::Fix::Condition::marc_has> but uses |
56
|
|
|
|
|
|
|
MARCspec - A common MARC record path language. |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
See L<MARCspec - A common MARC record path language|http://marcspec.github.io/MARCspec/> |
59
|
|
|
|
|
|
|
for documentation on the path syntax. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 METHODS |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 marc_spec_has(MARCspec) |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
Evaluates to true when the MARCspec references data, false otherwise. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 SEE ALSO |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=over |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item * L<Catmandu::Fix::marc_has> |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item * L<Catmandu::Fix::marc_match> |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item * L<Catmandu::Fix::marc_has_many> |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=back |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=cut |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |