line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::Condition::marc_spec_has; |
2
|
1
|
|
|
1
|
|
720
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
8
|
|
3
|
1
|
|
|
1
|
|
601
|
use Catmandu::Fix::marc_spec; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
4
|
|
4
|
1
|
|
|
1
|
|
347
|
use Catmandu::Fix::Condition::exists; |
|
1
|
|
|
|
|
9919
|
|
|
1
|
|
|
|
|
4
|
|
5
|
1
|
|
|
1
|
|
319
|
use Catmandu::Fix::set_field; |
|
1
|
|
|
|
|
3796
|
|
|
1
|
|
|
|
|
5
|
|
6
|
1
|
|
|
1
|
|
327
|
use Catmandu::Fix::remove_field; |
|
1
|
|
|
|
|
3684
|
|
|
1
|
|
|
|
|
4
|
|
7
|
1
|
|
|
1
|
|
54
|
use Moo; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
5
|
|
8
|
1
|
|
|
1
|
|
321
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
7
|
|
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
|
19691
|
my ($self,$fixer,$label) = @_; |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
|
|
7
|
my $perl; |
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
|
|
37
|
my $tmp_var = '_tmp_' . int(rand(9999)); |
22
|
2
|
|
|
|
|
34
|
my $marc_spec = Catmandu::Fix::marc_spec->new($self->marc_spec , "$tmp_var.\$append"); |
23
|
2
|
|
|
|
|
1748
|
$perl .= $marc_spec->emit($fixer,$label); |
24
|
|
|
|
|
|
|
|
25
|
2
|
|
|
|
|
29
|
my $all_match = Catmandu::Fix::Condition::exists->new("$tmp_var"); |
26
|
2
|
|
|
|
|
1509
|
my $remove_field = Catmandu::Fix::remove_field->new($tmp_var); |
27
|
|
|
|
|
|
|
|
28
|
2
|
|
|
|
|
1109
|
my $pass_fixes = $self->pass_fixes; |
29
|
2
|
|
|
|
|
7
|
my $fail_fixes = $self->fail_fixes; |
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
9
|
$all_match->pass_fixes([ $remove_field , @$pass_fixes ]); |
32
|
2
|
|
|
|
|
6
|
$all_match->fail_fixes([ $remove_field , @$fail_fixes ]); |
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
7
|
$perl .= $all_match->emit($fixer,$label); |
35
|
|
|
|
|
|
|
|
36
|
2
|
|
|
|
|
1394
|
$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; |