line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catmandu::Fix::Condition::marc_spec_has; |
2
|
1
|
|
|
1
|
|
668
|
use Catmandu::Sane; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
3
|
1
|
|
|
1
|
|
451
|
use Catmandu::Fix::marc_spec; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
4
|
|
4
|
1
|
|
|
1
|
|
308
|
use Catmandu::Fix::Condition::exists; |
|
1
|
|
|
|
|
8635
|
|
|
1
|
|
|
|
|
3
|
|
5
|
1
|
|
|
1
|
|
288
|
use Catmandu::Fix::set_field; |
|
1
|
|
|
|
|
3660
|
|
|
1
|
|
|
|
|
3
|
|
6
|
1
|
|
|
1
|
|
277
|
use Catmandu::Fix::remove_field; |
|
1
|
|
|
|
|
3149
|
|
|
1
|
|
|
|
|
3
|
|
7
|
1
|
|
|
1
|
|
49
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
8
|
1
|
|
|
1
|
|
276
|
use Catmandu::Fix::Has; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
3
|
|
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
|
17331
|
my ($self,$fixer,$label) = @_; |
18
|
|
|
|
|
|
|
|
19
|
2
|
|
|
|
|
4
|
my $perl; |
20
|
|
|
|
|
|
|
|
21
|
2
|
|
|
|
|
47
|
my $tmp_var = '_tmp_' . int(rand(9999)); |
22
|
2
|
|
|
|
|
27
|
my $marc_spec = Catmandu::Fix::marc_spec->new($self->marc_spec , "$tmp_var.\$append"); |
23
|
2
|
|
|
|
|
1595
|
$perl .= $marc_spec->emit($fixer,$label); |
24
|
|
|
|
|
|
|
|
25
|
2
|
|
|
|
|
27
|
my $all_match = Catmandu::Fix::Condition::exists->new("$tmp_var"); |
26
|
2
|
|
|
|
|
1491
|
my $remove_field = Catmandu::Fix::remove_field->new($tmp_var); |
27
|
|
|
|
|
|
|
|
28
|
2
|
|
|
|
|
1009
|
my $pass_fixes = $self->pass_fixes; |
29
|
2
|
|
|
|
|
6
|
my $fail_fixes = $self->fail_fixes; |
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
8
|
$all_match->pass_fixes([ $remove_field , @$pass_fixes ]); |
32
|
2
|
|
|
|
|
5
|
$all_match->fail_fixes([ $remove_field , @$fail_fixes ]); |
33
|
|
|
|
|
|
|
|
34
|
2
|
|
|
|
|
6
|
$perl .= $all_match->emit($fixer,$label); |
35
|
|
|
|
|
|
|
|
36
|
2
|
|
|
|
|
1096
|
$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; |