| 1 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | package Biblio::SICI::ControlSegment; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 3 | $Biblio::SICI::ControlSegment::VERSION = '0.04'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # ABSTRACT: The control 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 Biblio::SICI; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 3 | with 'Biblio::SICI::Role::ValidSegment', 'Biblio::SICI::Role::RecursiveLink'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 3 | has 'dpi' => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | is => 'rw', lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | trigger => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | default => quote_sub(q{ 0 }), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | predicate => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | clearer => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 58 | ▶ | sub _trigger_dpi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_trigger_dpi: called CC=5 SCAR=16.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 58 | my ( $self, $newVal ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 58 | ▶ | if ( not( "$newVal" eq "0" or "$newVal" eq "1" or "$newVal" eq "2" or "$newVal" eq "3" ) ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition88%8/9
"$newVal" eq '0' || "$newVal" eq '1' || "$newVal" eq '2' || "$newVal" eq '3'
"$newVal" eq 0 or "$newVal" eq 1 or "$newVal" eq 2
"$newVal" eq 0 or "$newVal" eq 1
MC/DC0%0/4
"$newVal" eq '0' || "$newVal" eq '1' || "$newVal" eq '2' || "$newVal" eq '3'
"$newVal" eq 0
"$newVal" eq 1
"$newVal" eq 2
"$newVal" eq '3'
Truth table80%4/5
A or B or C || D
A= "$newVal" eq 0B= "$newVal" eq 1C= "$newVal" eq 2D= "$newVal" eq '3'
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | $self->log_problem_on( 'dpi' => ['value not in allowed range (0|1|2|3)'] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 58 | $self->clear_problem_on('dpi'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 58 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 3 | has 'mfi' => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | is => 'rw', lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | trigger => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | default => quote_sub(q{ "ZU" }), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | predicate => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | clearer => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 59 | ▶ | sub _trigger_mfi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_trigger_mfi: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 59 | my ( $self, $newVal ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | 59 | ▶ | if ( $newVal !~ /\A(?:C[DFOT]|H[DE]|SC|T[BHLSX]|VX|Z[NUZ])\Z/ ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | 0 | $self->log_problem_on( 'mfi' => ['unknown identifier'] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 59 | $self->clear_problem_on('mfi'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 59 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 3 | has 'version' => ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | is => 'rw', lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | trigger => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | default => quote_sub(q{ 2 }), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | predicate => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | clearer => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 58 | ▶ | sub _trigger_version { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_trigger_version: called CC=2 SCAR=7.4
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 58 | my ( $self, $newVal ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 58 | ▶ | if ( $newVal != 2 ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | $self->log_problem( 'version' => ['unsupported version number (i.e. not "2")'] ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | 58 | $self->clear_problem_on('version'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 58 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | 237 | ▶ | sub csi { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
csi: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | 237 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 237 | ▶ | if ( $self->_sici()->contribution()->has_localNumber() ) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | 16 | return 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | 221 | ▶ | if ( $self->_sici()->contribution()->has_location() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$self->_sici->contribution->has_location or $self->_sici->contribution->has_titleCode
MC/DC100%2/2
$self->_sici->contribution->has_location or $self->_sici->contribution->has_titleCode
$self->_sici->contribution->has_location
$self->_sici->contribution->has_titleCode
Truth table100%3/3
A or B
A= $self->_sici->contribution->has_locationB= $self->_sici->contribution->has_titleCode
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | or $self->_sici()->contribution()->has_titleCode() ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 97 | return 2; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 124 | return 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 179 | ▶ | sub to_string { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
to_string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 179 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | # Every attribute in this class has a default value | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | 179 | return sprintf( '%s.%s.%s;%s', $self->csi(), $self->dpi(), $self->mfi(), $self->version() ); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 59 | ▶ | sub reset { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 59 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 59 | $self->clear_dpi(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | 59 | $self->clear_problem_on('dpi'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | 59 | $self->clear_mfi(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 59 | $self->clear_problem_on('mfi'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 59 | $self->clear_version(); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | 59 | $self->clear_problem_on('version'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | 59 | return; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||