line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Biblio::SICI::ContributionSegment; |
3
|
|
|
|
|
|
|
{ |
4
|
|
|
|
|
|
|
$Biblio::SICI::ContributionSegment::VERSION = '0.04'; |
5
|
|
|
|
|
|
|
} |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: The contribution segment of a SICI |
8
|
|
|
|
|
|
|
|
9
|
3
|
|
|
3
|
|
18
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
121
|
|
10
|
3
|
|
|
3
|
|
15
|
use warnings; |
|
3
|
|
|
|
|
48
|
|
|
3
|
|
|
|
|
95
|
|
11
|
3
|
|
|
3
|
|
84
|
use 5.010001; |
|
3
|
|
|
|
|
11
|
|
|
3
|
|
|
|
|
113
|
|
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
3
|
|
15
|
use Moo; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
18
|
|
14
|
3
|
|
|
3
|
|
1006
|
use Sub::Quote; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
221
|
|
15
|
|
|
|
|
|
|
|
16
|
3
|
|
|
3
|
|
14
|
use Biblio::SICI; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
125
|
|
17
|
|
|
|
|
|
|
with 'Biblio::SICI::Role::ValidSegment', 'Biblio::SICI::Role::RecursiveLink'; |
18
|
|
|
|
|
|
|
|
19
|
3
|
|
|
3
|
|
1686
|
use Biblio::SICI::Util (); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
1591
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has 'location' => ( is => 'rw', trigger => 1, predicate => 1, clearer => 1, ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub _trigger_location { |
25
|
26
|
|
|
26
|
|
1945
|
my ( $self, $newVal ) = @_; |
26
|
|
|
|
|
|
|
|
27
|
26
|
50
|
|
|
|
350
|
if ( $newVal !~ /\A${Biblio::SICI::Util::TITLE_CODE}+\Z/ ) { |
28
|
0
|
|
|
|
|
0
|
$self->log_problem_on( 'location' => ['contains invalid characters'] ); |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
else { |
31
|
26
|
|
|
|
|
86
|
$self->clear_problem_on('location'); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
26
|
|
|
|
|
517
|
return; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has 'titleCode' => ( is => 'rw', trigger => 1, predicate => 1, clearer => 1, ); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub _trigger_titleCode { |
41
|
27
|
|
|
27
|
|
1794
|
my ( $self, $newVal ) = @_; |
42
|
27
|
|
|
|
|
48
|
my @problems = (); |
43
|
|
|
|
|
|
|
|
44
|
27
|
50
|
|
|
|
85
|
if ( length $newVal > 6 ) { |
45
|
0
|
|
|
|
|
0
|
push @problems, 'contains more than 6 characters'; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
27
|
50
|
|
|
|
301
|
if ( $newVal !~ /\A${Biblio::SICI::Util::TITLE_CODE}+\Z/ ) { |
49
|
0
|
|
|
|
|
0
|
push @problems, 'contains invalid characters'; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
27
|
50
|
|
|
|
64
|
if (@problems) { |
53
|
0
|
|
|
|
|
0
|
$self->log_problem_on( titleCode => \@problems ); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
else { |
56
|
27
|
|
|
|
|
75
|
$self->clear_problem_on('titleCode'); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
27
|
|
|
|
|
514
|
return; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
has 'localNumber' => ( is => 'rw', trigger => 1, predicate => 1, clearer => 1, ); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub _trigger_localNumber { |
66
|
4
|
|
|
4
|
|
3542
|
my ( $self, $newVal ) = @_; |
67
|
|
|
|
|
|
|
|
68
|
4
|
50
|
|
|
|
74
|
if ( $newVal !~ /\A${Biblio::SICI::Util::TITLE_CODE}+\Z/ ) { |
69
|
0
|
|
|
|
|
0
|
$self->log_problem_on( 'location' => ['contains invalid characters'] ); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
else { |
72
|
4
|
|
|
|
|
15
|
$self->clear_problem_on('location'); |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
4
|
|
|
|
|
71
|
return; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub to_string { |
80
|
179
|
|
|
179
|
1
|
4626
|
my $self = shift; |
81
|
179
|
|
|
|
|
222
|
my $str = ''; |
82
|
|
|
|
|
|
|
|
83
|
179
|
100
|
|
|
|
481
|
if ( $self->has_location() ) { |
84
|
76
|
|
|
|
|
1438
|
$str .= $self->location(); |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
|
87
|
179
|
100
|
|
|
|
849
|
if ( $self->has_titleCode() ) { |
88
|
79
|
|
|
|
|
1484
|
$str .= ':' . $self->titleCode(); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
179
|
100
|
|
|
|
729
|
if ( $self->has_localNumber() ) { |
92
|
12
|
100
|
66
|
|
|
54
|
if ( $self->has_location() or $self->has_titleCode() ) { |
93
|
6
|
|
|
|
|
109
|
$str .= ':' . $self->localNumber(); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
else { |
96
|
6
|
|
|
|
|
113
|
$str .= '::' . $self->localNumber(); |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
179
|
|
|
|
|
543
|
return $str; |
101
|
|
|
|
|
|
|
} |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
sub reset { |
105
|
59
|
|
|
59
|
1
|
448
|
my $self = shift; |
106
|
59
|
|
|
|
|
1147
|
$self->clear_location(); |
107
|
59
|
|
|
|
|
1060
|
$self->clear_problem_on('location'); |
108
|
59
|
|
|
|
|
1150
|
$self->clear_titleCode(); |
109
|
59
|
|
|
|
|
1072
|
$self->clear_problem_on('titleCode'); |
110
|
59
|
|
|
|
|
1141
|
$self->clear_localNumber(); |
111
|
59
|
|
|
|
|
1131
|
$self->clear_problem_on('localNumber'); |
112
|
|
|
|
|
|
|
|
113
|
59
|
|
|
|
|
120
|
return; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
1; |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
__END__ |