| 1 | |||||||||||||||||||||||||||||||||||||||||||
| 2 | package Biblio::SICI::ItemSegment; | ||||||||||||||||||||||||||||||||||||||||||
| 3 | { | ||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | $Biblio::SICI::ItemSegment::VERSION = '0.04'; | |||||||||||||||||||||||||||||||||||||||||
| 5 | } | ||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | # ABSTRACT: The item segment of a SICI | ||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | ▶ | use 5.010001; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use Moo; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | 3 | ▶ | use Sub::Quote; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | ▶ | use Business::ISSN; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 3 | ▶ | use Biblio::SICI; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 3 | with 'Biblio::SICI::Role::ValidSegment', 'Biblio::SICI::Role::RecursiveLink'; | |||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 3 | has 'issn' => ( is => 'rw', trigger => 1, predicate => 1, clearer => 1, ); | |||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | 59 | ▶ | sub _trigger_issn { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_trigger_issn: called CC=7 SCAR=22.8
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 59 | my ( $self, $newVal ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 26 | 59 | my @problems = (); | |||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | 59 | ▶ | if ( $newVal !~ m!\A[0-9X-]+\Z! ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | push @problems, 'contains invalid characters'; | |||||||||||||||||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 59 | ▶ | if ( $newVal !~ m!\A[0-9]{4}\-[0-9]{3}[0-9X]\Z! ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | push @problems, 'structural error'; | |||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||
| 36 | 59 | ▶ | unless (@problems) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 59 | ▶ | if ( my $is = Business::ISSN->new($newVal) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 59 | ▶ | unless ( $is->is_valid ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | push @problems, 'invalid issn'; | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||
| 44 | 59 | ▶ | if (@problems) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | $self->log_problem_on( 'issn' => [@problems] ); | |||||||||||||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||||||||||||
| 47 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 59 | $self->clear_problem_on('issn'); | |||||||||||||||||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | 59 | return; | |||||||||||||||||||||||||||||||||||||||||
| 52 | } ## end sub _trigger_issn | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | 3 | has 'chronology' => ( is => 'rw', trigger => 1, predicate => 1, clearer => 1, ); | |||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||
| 57 | 58 | ▶ | sub _trigger_chronology { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_trigger_chronology: called CC=30 SCAR=49.6
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 58 | my ( $self, $newVal ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | # TODO calendar schemes other than Gregorian may be used?! | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 58 | my @problems = (); | |||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | # 1 YYYY | ||||||||||||||||||||||||||||||||||||||||||
| 65 | # 2 YYYY/YYYY with second YYYY > first YYYY | ||||||||||||||||||||||||||||||||||||||||||
| 66 | # 3 YYYYMM | ||||||||||||||||||||||||||||||||||||||||||
| 67 | # 4 YYYYMM/MM with second MM > first MM | ||||||||||||||||||||||||||||||||||||||||||
| 68 | # 5 YYYYMM/YYYYMM with second YYYY > first YYYY | ||||||||||||||||||||||||||||||||||||||||||
| 69 | # 6 YYYYMMDD | ||||||||||||||||||||||||||||||||||||||||||
| 70 | # 7 YYYYMMDD/DD with second DD > first DD | ||||||||||||||||||||||||||||||||||||||||||
| 71 | # 8 YYYYMMDD/MMDD with second MM > first MM | ||||||||||||||||||||||||||||||||||||||||||
| 72 | # 9 YYYYMMDD/YYYYMMDD with second YYYY > first YYYY | ||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||
| 74 | 58 | my (%e) = (); | |||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 58 | ▶ | if ( $newVal =~ /\A[0-9]{4}\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 9 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 77 | 11 | $e{'1Y'} = $newVal; | |||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||
| 79 | elsif ( $newVal =~ /\A([0-9]{4})\/([0-9]{4})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 1 | $e{'1Y'} = $1; | |||||||||||||||||||||||||||||||||||||||||
| 81 | 1 | $e{'2Y'} = $2; | |||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 1 | ▶ | unless ( $e{'2Y'} > $e{'1Y'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | push @problems, 'if specified, second year must be larger than first year'; | |||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | elsif ( $newVal =~ /\A([0-9]{4})([0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 24 | $e{'1Y'} = $1; | |||||||||||||||||||||||||||||||||||||||||
| 89 | 24 | $e{'1M'} = $2; | |||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||
| 91 | elsif ( $newVal =~ /\A([0-9]{4})([0-9]{2})\/([0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 7 | $e{'1Y'} = $1; | |||||||||||||||||||||||||||||||||||||||||
| 93 | 7 | $e{'1M'} = $2; | |||||||||||||||||||||||||||||||||||||||||
| 94 | 7 | $e{'2M'} = $3; | |||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 7 | ▶ | unless ( $e{'2M'} > $e{'1M'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 97 | 0 | push @problems, 'if specified, second month must be larger than first month'; | |||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | elsif ( $newVal =~ /\A([0-9]{4})([0-9]{2})\/([0-9]{4})([0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 1 | $e{'1Y'} = $1; | |||||||||||||||||||||||||||||||||||||||||
| 102 | 1 | $e{'1M'} = $2; | |||||||||||||||||||||||||||||||||||||||||
| 103 | 1 | $e{'2Y'} = $3; | |||||||||||||||||||||||||||||||||||||||||
| 104 | 1 | $e{'2M'} = $4; | |||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | 1 | ▶ | unless ( $e{'2Y'} > $e{'1Y'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | push @problems, 'if specified, second year must be larger than first year'; | |||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | elsif ( $newVal =~ /\A([0-9]{4})([0-9]{2})([0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 111 | 14 | $e{'1Y'} = $1; | |||||||||||||||||||||||||||||||||||||||||
| 112 | 14 | $e{'1M'} = $2; | |||||||||||||||||||||||||||||||||||||||||
| 113 | 14 | $e{'1D'} = $3; | |||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||
| 115 | elsif ( $newVal =~ /\A([0-9]{4})([0-9]{2})([0-9]{2})\/([0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | $e{'1Y'} = $1; | |||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | $e{'1M'} = $2; | |||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | $e{'1D'} = $3; | |||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | $e{'2D'} = $4; | |||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | unless ( $e{'2D'} > $e{'1D'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | push @problems, 'if specified, second day must be larger than first day'; | |||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | elsif ( $newVal =~ /\A([0-9]{4})([0-9]{2})([0-9]{2})\/([0-9]{2})([0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | $e{'1Y'} = $1; | |||||||||||||||||||||||||||||||||||||||||
| 127 | 0 | $e{'1M'} = $2; | |||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | $e{'1D'} = $3; | |||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | $e{'2M'} = $4; | |||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | $e{'2D'} = $5; | |||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | unless ( $e{'2M'} > $e{'1M'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | push @problems, 'if specified, second month must be larger than first month'; | |||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | elsif ( $newVal =~ /\A([0-9]{4})([0-9]{2})([0-9]{2})\/([0-9]{4})([0-9]{2})([0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $e{'1Y'} = $1; | |||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | $e{'1M'} = $2; | |||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | $e{'1D'} = $3; | |||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | $e{'2Y'} = $4; | |||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | $e{'2M'} = $5; | |||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | $e{'2D'} = $6; | |||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | unless ( $e{'2Y'} > $e{'1Y'} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | push @problems, 'if specified, second year must be larger than first year'; | |||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 148 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | $self->log_problem_on( 'chronology', ['illegal chronology structure'] ); | |||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | # lets accept pub dates up to one year in the future | ||||||||||||||||||||||||||||||||||||||||||
| 154 | # (relative to the date when this code is executed!) | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 58 | my (@time) = localtime(time); | |||||||||||||||||||||||||||||||||||||||||
| 156 | 58 | my $yr = $time[5] + 1900; | |||||||||||||||||||||||||||||||||||||||||
| 157 | 58 | my ( undef, undef, $decade, $year ) = split( '', $yr ); | |||||||||||||||||||||||||||||||||||||||||
| 158 | 58 | ▶ | if ( $year == 9 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | 0 | $year = 0; | |||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | $decade += 1; | |||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||
| 162 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 163 | 58 | $year += 1; | |||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | 58 | my $prevDecade = $decade - 1; | |||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 58 | for (qw( 2D 1D )) { | |||||||||||||||||||||||||||||||||||||||||
| 168 | 116 | ▶ | if ( exists $e{$_} and $e{$_} !~ /\A(?:[012][0-9]|3[01])\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $e{$_} and not $e{$_} =~ /\A(?:[012][0-9]|3[01])\Z/
MC/DC0%0/2
exists $e{$_} and not $e{$_} =~ /\A(?:[012][0-9]|3[01])\Z/
exists $e{$_}
not $e{$_} =~ /\A(?:[012][0-9]|3[01])\Z/
Truth table66%2/3
A and not(B)
A= exists $e{$_}B= not $e{$_} =~ /\A(?:[012][0-9]|3[01])\Z/
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | push @problems, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 170 | 'illegal value for ' | ||||||||||||||||||||||||||||||||||||||||||
| 171 | . ( $_ eq '2D' ? 'second' : 'first' ) | ||||||||||||||||||||||||||||||||||||||||||
| 172 | . ' day: should be 01-31'; | ||||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 58 | for (qw( 2M 1M )) { | |||||||||||||||||||||||||||||||||||||||||
| 176 | 116 | ▶ | if ( exists $e{$_} and $e{$_} !~ /\A(?:0[0-9]|1[012]|[23][1-4])\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $e{$_} and not $e{$_} =~ /\A(?:0[0-9]|1[012]|[23][1-4])\Z/
MC/DC0%0/2
exists $e{$_} and not $e{$_} =~ /\A(?:0[0-9]|1[012]|[23][1-4])\Z/
exists $e{$_}
not $e{$_} =~ /\A(?:0[0-9]|1[012]|[23][1-4])\Z/
Truth table66%2/3
A and not(B)
A= exists $e{$_}B= not $e{$_} =~ /\A(?:0[0-9]|1[012]|[23][1-4])\Z/
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | push @problems, | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 'illegal value for ' | ||||||||||||||||||||||||||||||||||||||||||
| 179 | . ( $_ eq '2M' ? 'second' : 'first' ) | ||||||||||||||||||||||||||||||||||||||||||
| 180 | . ' month: should be 00-12, or 21-24, or 31-34'; | ||||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | 58 | for (qw( 2Y 1Y )) { | |||||||||||||||||||||||||||||||||||||||||
| 184 | 116 | ▶ | if ( exists $e{$_} | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $e{$_} and not $e{$_} =~ /\A(?:1[0-9][0-9]{2}|20[0-$prevDecade][0-9]|20${decade}[0-$year])\Z/o
MC/DC0%0/2
exists $e{$_} and not $e{$_} =~ /\A(?:1[0-9][0-9]{2}|20[0-$prevDecade][0-9]|20${decade}[0-$year])\Z/o
exists $e{$_}
not $e{$_} =~ /\A(?:1[0-9][0-9]{2}|20[0-$prevDecade][0-9]|20${decade}[0-$year])\Z/o
Truth table66%2/3
A and not(B)
A= exists $e{$_}B= not $e{$_} =~ /\A(?:1[0-9][0-9]{2}|20[0-$prevDecade][0-9]|20${decade}[0-$year])\Z/o
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | and $e{$_} !~ /\A(?:1[0-9][0-9]{2}|20[0-$prevDecade][0-9]|20$decade[0-$year])\Z/o ) | ||||||||||||||||||||||||||||||||||||||||||
| 186 | { | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | push @problems, 'illegal value for ' . ( $_ eq '2Y' ? 'second' : 'first' ) . ' year'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 58 | ▶ | if ( !@problems ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | 58 | $self->clear_problem_on('chronology'); | |||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||
| 194 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | $self->log_problem_on( 'chronology', \@problems ); | |||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | 58 | return; | |||||||||||||||||||||||||||||||||||||||||
| 199 | } ## end sub _trigger_chronology | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | 3 | has 'enumeration' => ( is => 'rw', predicate => 1, clearer => 1, trigger => 1, ); | |||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | 17 | ▶ | sub _trigger_enumeration { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_trigger_enumeration: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||||||||||||||||
| 205 | 17 | my ( $self, $newVal ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | # clear partial values | ||||||||||||||||||||||||||||||||||||||||||
| 208 | 17 | $self->clear_volume(); | |||||||||||||||||||||||||||||||||||||||||
| 209 | 17 | $self->clear_problem_on('volume'); | |||||||||||||||||||||||||||||||||||||||||
| 210 | 17 | $self->clear_issue(); | |||||||||||||||||||||||||||||||||||||||||
| 211 | 17 | $self->clear_problem_on('issue'); | |||||||||||||||||||||||||||||||||||||||||
| 212 | 17 | $self->clear_supplOrIdx(); | |||||||||||||||||||||||||||||||||||||||||
| 213 | 17 | $self->clear_problem_on('supplOrIdx'); | |||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | 17 | ▶ | if ( $newVal !~ /\A[0-9A-Z:]*[+*]?\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | $self->log_problem_on( 'enumeration' => ['invalid characters used'] ); | |||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | 17 | return; | |||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 3 | has 'volume' => ( is => 'rw', predicate => 1, clearer => 1, trigger => 1, ); | |||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | 40 | ▶ | sub _trigger_volume { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_trigger_volume: called CC=4 SCAR=15.2
| |||||||||||||||||||||||||||||||||||||||||||
| 225 | 40 | my ( $self, $newVal ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | # clear aggregate value | ||||||||||||||||||||||||||||||||||||||||||
| 228 | 40 | $self->clear_enumeration(); | |||||||||||||||||||||||||||||||||||||||||
| 229 | 40 | $self->clear_problem_on('enumeration'); | |||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | 40 | my @problems = (); | |||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | 40 | ▶ | if ( $newVal !~ m!\A[A-Z0-9/]+\Z! ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | push @problems, 'contains invalid characters'; | |||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | 40 | ▶ | if ( $newVal !~ m!\A[A-Z0-9]+(?:/[A-Z0-9]+)?\Z! ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | push @problems, 'structural error'; | |||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | 40 | ▶ | if (@problems) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $self->log_problem_on( 'volume' => [@problems] ); | |||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||
| 244 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 40 | $self->clear_problem_on('volume'); | |||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | 40 | return; | |||||||||||||||||||||||||||||||||||||||||
| 249 | } ## end sub _trigger_volume | ||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | 3 | has 'issue' => ( is => 'rw', predicate => 1, clearer => 1, trigger => 1, ); | |||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 40 | ▶ | sub _trigger_issue { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_trigger_issue: called CC=4 SCAR=15.2
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 40 | my ( $self, $newVal ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | # clear aggregate value | ||||||||||||||||||||||||||||||||||||||||||
| 258 | 40 | $self->clear_enumeration(); | |||||||||||||||||||||||||||||||||||||||||
| 259 | 40 | $self->clear_problem_on('enumeration'); | |||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | 40 | my @problems = (); | |||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | 40 | ▶ | if ( $newVal !~ m!\A[A-Z0-9/]+\Z! ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | push @problems, 'contains invalid characters'; | |||||||||||||||||||||||||||||||||||||||||
| 265 | } | ||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||
| 267 | 40 | ▶ | if ( $newVal !~ m!\A[A-Z0-9]+(?:/[A-Z0-9]+)?\Z! ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | push @problems, 'structural error'; | |||||||||||||||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||
| 271 | 40 | ▶ | if (@problems) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | $self->log_problem_on( 'issue' => [@problems] ); | |||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||
| 274 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 275 | 40 | $self->clear_problem_on('issue'); | |||||||||||||||||||||||||||||||||||||||||
| 276 | } | ||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||
| 278 | 40 | return; | |||||||||||||||||||||||||||||||||||||||||
| 279 | } ## end sub _trigger_issue | ||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | 3 | has 'supplOrIdx' => ( is => 'rw', predicate => 1, clearer => 1, trigger => 1, ); | |||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | sub _trigger_supplOrIdx { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_trigger_supplOrIdx: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | my ( $self, $newVal ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | # clear aggregate value | ||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | $self->clear_enumeration(); | |||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | $self->clear_problem_on('enumeration'); | |||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||
| 291 | 0 | my @problems = (); | |||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | ▶ | if ( length $newVal != 1 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | push @problems, 'too many characters (allowed: 1)'; | |||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | if ( $newVal ne '+' and $newVal ne '*' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$newVal ne "+" and $newVal ne "*"
MC/DC0%0/2
$newVal ne "+" and $newVal ne "*"
$newVal ne "+"
$newVal ne "*"
Truth table0%0/3
A and B
A= $newVal ne "+"B= $newVal ne "*"
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | push @problems, 'contains invalid characters'; | |||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | ▶ | if (@problems) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | $self->log_problem_on( 'supplOrIdx' => [@problems] ); | |||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||
| 304 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | $self->clear_problem_on('supplOrIdx'); | |||||||||||||||||||||||||||||||||||||||||
| 306 | } | ||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 309 | } ## end sub _trigger_supplOrIdx | ||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | ▶ | sub year { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
year: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | return unless $self->has_chronology(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | 0 | my $c = $self->chronology; | |||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | # 1 YYYY | ||||||||||||||||||||||||||||||||||||||||||
| 320 | # 2 YYYY/YYYY with second YYYY > first YYYY | ||||||||||||||||||||||||||||||||||||||||||
| 321 | # 3 YYYYMM | ||||||||||||||||||||||||||||||||||||||||||
| 322 | # 4 YYYYMM/MM with second MM > first MM | ||||||||||||||||||||||||||||||||||||||||||
| 323 | # 5 YYYYMM/YYYYMM with second YYYY > first YYYY | ||||||||||||||||||||||||||||||||||||||||||
| 324 | # 6 YYYYMMDD | ||||||||||||||||||||||||||||||||||||||||||
| 325 | # 7 YYYYMMDD/DD with second DD > first DD | ||||||||||||||||||||||||||||||||||||||||||
| 326 | # 8 YYYYMMDD/MMDD with second MM > first MM | ||||||||||||||||||||||||||||||||||||||||||
| 327 | # 9 YYYYMMDD/YYYYMMDD with second YYYY > first YYYY | ||||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | ▶ | if ( $c =~ /\A[0-9]{4}\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 9 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | return "$c"; | |||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||
| 332 | elsif ( $c =~ /\A([0-9]{4})\/([0-9]{4})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | return ( "$1", "$2" ); | |||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||
| 335 | elsif ( $c =~ /\A([0-9]{4})(?:[0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 336 | 0 | return "$1"; | |||||||||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||||||||
| 338 | elsif ( $c =~ /\A([0-9]{4})(?:[0-9]{2})\/(?:[0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | return "$1"; | |||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||
| 341 | elsif ( $c =~ /\A([0-9]{4})(?:[0-9]{2})\/([0-9]{4})(?:[0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | return ( "$1", "$2" ); | |||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||
| 344 | elsif ( $c =~ /\A([0-9]{4})(?:[0-9]{2})(?:[0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | return "$1"; | |||||||||||||||||||||||||||||||||||||||||
| 346 | } | ||||||||||||||||||||||||||||||||||||||||||
| 347 | elsif ( $c =~ /\A([0-9]{4})(?:[0-9]{2})(?:[0-9]{2})\/(?:[0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | return "$1"; | |||||||||||||||||||||||||||||||||||||||||
| 349 | } | ||||||||||||||||||||||||||||||||||||||||||
| 350 | elsif ( $c =~ /\A([0-9]{4})(?:[0-9]{2})(?:[0-9]{2})\/(?:[0-9]{2})(?:[0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | return "$1"; | |||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||
| 353 | elsif ( $c =~ /\A([0-9]{4})(?:[0-9]{2})(?:[0-9]{2})\/([0-9]{4})(?:[0-9]{2})(?:[0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | return ( "$1", "$2" ); | |||||||||||||||||||||||||||||||||||||||||
| 355 | } | ||||||||||||||||||||||||||||||||||||||||||
| 356 | |||||||||||||||||||||||||||||||||||||||||||
| 357 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 358 | } ## end sub year | ||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | ▶ | sub month { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
month: not called CC=9 SCAR=45.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 362 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | ▶ | return unless $self->has_chronology(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | my $c = $self->chronology; | |||||||||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||||||||
| 368 | # 3 YYYYMM | ||||||||||||||||||||||||||||||||||||||||||
| 369 | # 4 YYYYMM/MM with second MM > first MM | ||||||||||||||||||||||||||||||||||||||||||
| 370 | # 5 YYYYMM/YYYYMM with second YYYY > first YYYY | ||||||||||||||||||||||||||||||||||||||||||
| 371 | # 6 YYYYMMDD | ||||||||||||||||||||||||||||||||||||||||||
| 372 | # 7 YYYYMMDD/DD with second DD > first DD | ||||||||||||||||||||||||||||||||||||||||||
| 373 | # 8 YYYYMMDD/MMDD with second MM > first MM | ||||||||||||||||||||||||||||||||||||||||||
| 374 | # 9 YYYYMMDD/YYYYMMDD with second YYYY > first YYYY | ||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | if ( $c =~ /\A(?:[0-9]{4})([0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | return "$1"; | |||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 379 | elsif ( $c =~ /\A(?:[0-9]{4})([0-9]{2})\/([0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | return ( "$1", "$2" ); | |||||||||||||||||||||||||||||||||||||||||
| 381 | } | ||||||||||||||||||||||||||||||||||||||||||
| 382 | elsif ( $c =~ /\A(?:[0-9]{4})([0-9]{2})\/(?:[0-9]{4})([0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 383 | 0 | return ( "$1", "$2" ); | |||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||
| 385 | elsif ( $c =~ /\A(?:[0-9]{4})([0-9]{2})(?:[0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 386 | 0 | return "$1"; | |||||||||||||||||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||||||||||||||||
| 388 | elsif ( $c =~ /\A(?:[0-9]{4})([0-9]{2})(?:[0-9]{2})\/(?:[0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | return "$1"; | |||||||||||||||||||||||||||||||||||||||||
| 390 | } | ||||||||||||||||||||||||||||||||||||||||||
| 391 | elsif ( $c =~ /\A(?:[0-9]{4})([0-9]{2})(?:[0-9]{2})\/([0-9]{2})(?:[0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | return ( "$1", "$2" ); | |||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||
| 394 | elsif ( $c =~ /\A(?:[0-9]{4})([0-9]{2})(?:[0-9]{2})\/(?:[0-9]{4})([0-9]{2})(?:[0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 395 | 0 | return ( "$1", "$2" ); | |||||||||||||||||||||||||||||||||||||||||
| 396 | } | ||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 399 | } ## end sub month | ||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||
| 402 | 0 | ▶ | sub day { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
day: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 403 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 404 | |||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | ▶ | return unless $self->has_chronology(); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 406 | |||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | my $c = $self->chronology; | |||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||
| 409 | # 6 YYYYMMDD | ||||||||||||||||||||||||||||||||||||||||||
| 410 | # 7 YYYYMMDD/DD with second DD > first DD | ||||||||||||||||||||||||||||||||||||||||||
| 411 | # 8 YYYYMMDD/MMDD with second MM > first MM | ||||||||||||||||||||||||||||||||||||||||||
| 412 | # 9 YYYYMMDD/YYYYMMDD with second YYYY > first YYYY | ||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | 0 | ▶ | if ( $c =~ /\A(?:[0-9]{4})(?:[0-9]{2})([0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | return "$1"; | |||||||||||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||||||||||||
| 417 | elsif ( $c =~ /\A(?:[0-9]{4})(?:[0-9]{2})([0-9]{2})\/([0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | return ( "$1", "$2" ); | |||||||||||||||||||||||||||||||||||||||||
| 419 | } | ||||||||||||||||||||||||||||||||||||||||||
| 420 | elsif ( $c =~ /\A(?:[0-9]{4})(?:[0-9]{2})([0-9]{2})\/(?:[0-9]{2})([0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 421 | 0 | return ( "$1", "$2" ); | |||||||||||||||||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||||||||||||||||
| 423 | elsif ( $c =~ /\A(?:[0-9]{4})(?:[0-9]{2})([0-9]{2})\/(?:[0-9]{4})(?:[0-9]{2})([0-9]{2})\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | return ( "$1", "$2" ); | |||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 428 | } ## end sub day | ||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | 179 | ▶ | sub to_string { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_string: called CC=7 SCAR=19.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 432 | 179 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | 179 | my $str = ''; | |||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||
| 436 | 179 | ▶ | if ( $self->has_issn() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 437 | 179 | $str = $self->issn(); | |||||||||||||||||||||||||||||||||||||||||
| 438 | } | ||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | 179 | ▶ | if ( $self->has_chronology() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 441 | 176 | $str .= '(' . $self->chronology() . ')'; | |||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||
| 443 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 444 | 3 | $str .= '()'; | |||||||||||||||||||||||||||||||||||||||||
| 445 | } | ||||||||||||||||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||||||||||||||||
| 447 | 179 | ▶ | if ( $self->has_enumeration() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 448 | 52 | $str .= $self->enumeration(); | |||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||
| 450 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 451 | 127 | ▶ | if ( $self->has_volume() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 452 | 118 | $str .= $self->volume(); | |||||||||||||||||||||||||||||||||||||||||
| 453 | 118 | ▶ | if ( $self->has_issue() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 454 | 118 | $str .= ':' . $self->issue(); | |||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||
| 456 | } | ||||||||||||||||||||||||||||||||||||||||||
| 457 | 127 | ▶ | if ( $self->has_supplOrIdx() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | $str .= $self->supplOrIdx(); | |||||||||||||||||||||||||||||||||||||||||
| 459 | } | ||||||||||||||||||||||||||||||||||||||||||
| 460 | } | ||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | 179 | return $str; | |||||||||||||||||||||||||||||||||||||||||
| 463 | } ## end sub to_string | ||||||||||||||||||||||||||||||||||||||||||
| 464 | |||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||
| 466 | 58 | ▶ | sub reset { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 467 | 58 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 468 | 58 | $self->clear_issn(); | |||||||||||||||||||||||||||||||||||||||||
| 469 | 58 | $self->clear_problem_on('issn'); | |||||||||||||||||||||||||||||||||||||||||
| 470 | 58 | $self->clear_chronology(); | |||||||||||||||||||||||||||||||||||||||||
| 471 | 58 | $self->clear_problem_on('chronology'); | |||||||||||||||||||||||||||||||||||||||||
| 472 | 58 | $self->clear_enumeration(); | |||||||||||||||||||||||||||||||||||||||||
| 473 | 58 | $self->clear_problem_on('enumeration'); | |||||||||||||||||||||||||||||||||||||||||
| 474 | 58 | $self->clear_volume(); | |||||||||||||||||||||||||||||||||||||||||
| 475 | 58 | $self->clear_problem_on('volumne'); | |||||||||||||||||||||||||||||||||||||||||
| 476 | 58 | $self->clear_issue(); | |||||||||||||||||||||||||||||||||||||||||
| 477 | 58 | $self->clear_problem_on('issue'); | |||||||||||||||||||||||||||||||||||||||||
| 478 | 58 | $self->clear_supplOrIdx(); | |||||||||||||||||||||||||||||||||||||||||
| 479 | 58 | $self->clear_problem_on('supplOrIdx'); | |||||||||||||||||||||||||||||||||||||||||
| 480 | 58 | return; | |||||||||||||||||||||||||||||||||||||||||
| 481 | } | ||||||||||||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||
| 484 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 485 | |||||||||||||||||||||||||||||||||||||||||||
| 486 | __END__ | ||||||||||||||||||||||||||||||||||||||||||