blib/lib/SWIFT/Factory/Tag/Tag15.pm

filter: Statementstmt 38.2% 13 / 34 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 40.0% 4 / 10 Podpod 100% 4 / 4 totaltotal 30.4% 21 / 69 CC 10 SCAR 26.8
CC
10
Cov
25%
_store_seq_id
30.0
sequence_id
20.0
_init
12.0
CRAP 14.5
↑ Summary
1 package SWIFT::Factory::Tag::Tag15;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 ###########################################################################################################
6 # Provide a SWIFT TAG 15a.
7 #
8 # Use this class to provide all different tags 15A, 15B .. 15Z.
9 #
10 ###########################################################################################################
11  
12 1 ▶BEGIN{
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 *provide=*string;
14 1 *borken=*invalid;
15 }
16  
17 1 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 $VERSION='0.02';
19  
20 ###########################################################################################################
21 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod documented
22 0 my$self={};
23 0 bless($self,shift())->_init(@_);
24 }
25  
26 ###########################################################################################################
27 # The class cannot guarantee that the TAG will be valid in the SWIFT network.
28 # It can point out that it's found some invalid data, though.
29 # Return number of problems detected.
30 0 ▶sub invalid {
Subroutine invalid: not called CC=1 SCAR=6.9
Pod documented
31 0 my$self=shift;
32  
33 # Implement verifications here!
34 0 0;
35 }
36  
37 ###########################################################################################################
38 # If a new Sequence ID is provided, store it for future use.
39 # If requested, return the stored Sequence ID to the caller.
40 0 ▶sub sequence_id {
Subroutine sequence_id: not called CC=4 SCAR=30.0
Pod documented
41 0 my($self,$seq_id)=@_;
42 0 ▶ defined($seq_id)&&$self->_store_seq_id($seq_id);
Branch: 1 branch
BranchTrueFalseTotal
defined $seq_id and $self->_store_seq_id($seq_id) 0 0 0
43 0 ▶ return(defined(wantarray)?wantarray?($self->{SEQUENCE_ID}):$self->{SEQUENCE_ID}:undef);
Branch: 2 branches
BranchTrueFalseTotal
defined wantarray ? : 0 0 0
wantarray ? : 0 0 0
44 }
45  
46 ###########################################################################################################
47 0 ▶sub string {
Subroutine string: not called CC=1 SCAR=6.9
Pod documented
48 0 my$self=shift;
49 ':15'.
50 $self->{SEQUENCE_ID}.
51 0 ':'.
52 chr(13). # CR
53 chr(10); # LF
54 }
55  
56 ###########################################################################################################
57 ###########################################################################################################
58 #
59 # 'Internal' subs. Don't call these since they may, and will, change without notice.
60 #
61 ###########################################################################################################
62 ###########################################################################################################
63  
64 ###########################################################################################################
65 0 ▶sub _init {
Subroutine _init: not called CC=3 SCAR=24.8
66 0 my$self=shift();
67 0 my%args=(
68 DO_CLEANUP=>0,
69 SEQUENCE_ID=>'',
70 @_);
71  
72 0 ▶ $self->{DO_CLEANUP}=defined($args{DO_CLEANUP})?$args{DO_CLEANUP}?1:0:0;
Branch: 2 branches
BranchTrueFalseTotal
defined $args{'DO_CLEANUP'} ? : 0 0 0
$args{'DO_CLEANUP'} ? : 0 0 0
73 0 $self->_store_seq_id($args{SEQUENCE_ID});
74 0 $self;
75 }
76  
77 ###########################################################################################################
78 # If Sequence ID is defined, store it together with some simple cleanup applied.
79 0 ▶sub _store_seq_id {
Subroutine _store_seq_id: not called CC=5 SCAR=34.0
80 0 my($self,$seq_id)=@_;
81  
82 0 ▶ defined($seq_id)||return;
Branch: 1 branch
BranchTrueFalseTotal
defined $seq_id or return 0 0 0
83  
84 0 ▶ $self->{DO_CLEANUP}&&length($seq_id)>1&&do{
Branch: 1 branch
BranchTrueFalseTotal
$self->{"DO_CLEANUP"} and length $seq_id > 1 and do { $seq_id = substr($seq_id, 0, 1) } 0 0 0
Condition0%0/3
$self->{"DO_CLEANUP"} and length $seq_id > 1
!ll&&!rl&&r
000
MC/DC0%0/2
$self->{"DO_CLEANUP"} and length $seq_id > 1
$self->{"DO_CLEANUP"} length $seq_id > 1
Truth table0%0/3
A and B
A= $self->{"DO_CLEANUP"}B= length $seq_id > 1
ABresult
0X0
100
111
85 # Apply conditional warnings here!
86 0 $seq_id=substr($seq_id,0,1);
87 };
88  
89 0 ▶ $self->{DO_CLEANUP}&&do{
Branch: 1 branch
BranchTrueFalseTotal
$self->{"DO_CLEANUP"} and do { $seq_id = uc $seq_id } 0 0 0
90 # Apply warnings here too.
91 0 $seq_id=uc($seq_id);
92 };
93  
94 0 $self->{SEQUENCE_ID}=$seq_id;
95 }
96  
97 ###########################################################################################################
98 1 'Choppers rule';
99 __END__
↑ Summary