| 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
| |||||||||||||||||||||||||||||
| 43 | 0 | ▶ | return(defined(wantarray)?wantarray?($self->{SEQUENCE_ID}):$self->{SEQUENCE_ID}:undef); | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 0 | ▶ | $self->{DO_CLEANUP}&&length($seq_id)>1&&do{ | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"DO_CLEANUP"} and length $seq_id > 1
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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||