| 1 | package SWIFT::Factory::ApplicationHeader; | ||||||||||||||||||||||||||||
| 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 | 1 | ▶ | use vars qw($VERSION); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | $VERSION='0.02'; | |||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use constant MSG_PRIORITY_SYSTEM=>'S'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use constant MSG_PRIORITY_URGENT=>'U'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use constant MSG_PRIORITY_NORMAL=>'N'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | use constant MONITORING_NON_DELIVERY=>1; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | 1 | ▶ | use constant MONITORING_DELIVERY_NOTIFICATION=>2; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 14 | 1 | ▶ | use constant MONITORING_DELIVERY_BOTH=>3; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 1 | ▶ | BEGIN{ | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 17 | 1 | *provide=*string; | |||||||||||||||||||||||||||
| 18 | 1 | *borken=*invalid; | |||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | ########################################################################################################### | ||||||||||||||||||||||||||||
| 22 | # The Application Header is block number 2 of a SWIFT message. | ||||||||||||||||||||||||||||
| 23 | # This block is not required in all SWIFT messages. | ||||||||||||||||||||||||||||
| 24 | # | ||||||||||||||||||||||||||||
| 25 | # The block is normally built for "input", which in SWIFT | ||||||||||||||||||||||||||||
| 26 | # speak means "input to the SWIFT network". | ||||||||||||||||||||||||||||
| 27 | # | ||||||||||||||||||||||||||||
| 28 | # This module will implement an "Input Application Header". | ||||||||||||||||||||||||||||
| 29 | ########################################################################################################### | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | ########################################################################################################### | ||||||||||||||||||||||||||||
| 32 | # Class private stuff. | ||||||||||||||||||||||||||||
| 33 | 0 | ▶ | my$io_id_input=sub{'I'}; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 34 | ########################################################################################################### | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | ########################################################################################################### | ||||||||||||||||||||||||||||
| 37 | # Constructor. | ||||||||||||||||||||||||||||
| 38 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 39 | 0 | my$self={}; | |||||||||||||||||||||||||||
| 40 | 0 | bless($self,shift())->_init(@_); | |||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | ########################################################################################################### | ||||||||||||||||||||||||||||
| 44 | # The class cannot guarantee that the provided string will be valid in the SWIFT network. | ||||||||||||||||||||||||||||
| 45 | # It can point out that it's found some invalid data, though. | ||||||||||||||||||||||||||||
| 46 | # Return number of problems detected. | ||||||||||||||||||||||||||||
| 47 | 0 | ▶ | sub invalid { | ||||||||||||||||||||||||||
|
Subroutine
invalid: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 48 | 0 | my$self=shift; | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | # Implement verifications here! | ||||||||||||||||||||||||||||
| 51 | 0 | 0; | |||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | ########################################################################################################### | ||||||||||||||||||||||||||||
| 55 | 0 | ▶ | sub string { | ||||||||||||||||||||||||||
|
Subroutine
string: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 56 | 0 | my$self=shift; | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | '{2:'. | ||||||||||||||||||||||||||||
| 59 | $self->$io_id_input(). | ||||||||||||||||||||||||||||
| 60 | sprintf("%03u",$self->{MSG_TYPE}). | ||||||||||||||||||||||||||||
| 61 | $self->{BIC}. | ||||||||||||||||||||||||||||
| 62 | $self->{TERMINAL}. | ||||||||||||||||||||||||||||
| 63 | $self->{BRANCH_CODE}. | ||||||||||||||||||||||||||||
| 64 | $self->{MSG_PRIORITY}. | ||||||||||||||||||||||||||||
| 65 | $self->{DELIVERY_MONITORING}. | ||||||||||||||||||||||||||||
| 66 | 0 | ▶ | (defined($self->{OBSOLESCENCE_PERIOD})&&length($self->{OBSOLESCENCE_PERIOD})?sprintf("%03u",$self->{OBSOLESCENCE_PERIOD}):''). | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $self->{"OBSOLESCENCE_PERIOD"} and length $self->{"OBSOLESCENCE_PERIOD"}
MC/DC0%0/2
defined $self->{"OBSOLESCENCE_PERIOD"} and length $self->{"OBSOLESCENCE_PERIOD"}
defined $self->{"OBSOLESCENCE_PERIOD"}
length $self->{"OBSOLESCENCE_PERIOD"}
Truth table0%0/3
A and B
A= defined $self->{"OBSOLESCENCE_PERIOD"}B= length $self->{"OBSOLESCENCE_PERIOD"}
| |||||||||||||||||||||||||||||
| 67 | '}'; | ||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | ########################################################################################################### | ||||||||||||||||||||||||||||
| 71 | ########################################################################################################### | ||||||||||||||||||||||||||||
| 72 | # | ||||||||||||||||||||||||||||
| 73 | # 'Internal' subs. Don't call these since they may, and will, change without notice. | ||||||||||||||||||||||||||||
| 74 | # | ||||||||||||||||||||||||||||
| 75 | ########################################################################################################### | ||||||||||||||||||||||||||||
| 76 | ########################################################################################################### | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | ########################################################################################################### | ||||||||||||||||||||||||||||
| 79 | 0 | ▶ | sub _init { | ||||||||||||||||||||||||||
|
Subroutine
_init: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 80 | 0 | my$self=shift; | |||||||||||||||||||||||||||
| 81 | 0 | my%args=( | |||||||||||||||||||||||||||
| 82 | MESSAGE_TYPE=>0, | ||||||||||||||||||||||||||||
| 83 | BIC=>'X'x8, # Receiver BIC for SWIFT input msg. | ||||||||||||||||||||||||||||
| 84 | TERMINAL=>'X', # Receiver Terminal for SWIFT input msg. | ||||||||||||||||||||||||||||
| 85 | BRANCH_CODE=>'X'x3, # Receiver Branch code for SWIFT input msg. | ||||||||||||||||||||||||||||
| 86 | MESSAGE_PRIORITY=>MSG_PRIORITY_NORMAL, | ||||||||||||||||||||||||||||
| 87 | DELIVERY_MONITORING=>'', | ||||||||||||||||||||||||||||
| 88 | OBSOLESCENCE_PERIOD=>'', | ||||||||||||||||||||||||||||
| 89 | @_ | ||||||||||||||||||||||||||||
| 90 | ); | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 0 | $self->{MSG_TYPE}=$args{MESSAGE_TYPE}; | |||||||||||||||||||||||||||
| 93 | 0 | $self->{BIC}=$args{BIC}; | |||||||||||||||||||||||||||
| 94 | 0 | $self->{TERMINAL}=$args{TERMINAL}; | |||||||||||||||||||||||||||
| 95 | 0 | $self->{BRANCH_CODE}=$args{BRANCH_CODE}; | |||||||||||||||||||||||||||
| 96 | 0 | $self->{MSG_PRIORITY}=$args{MESSAGE_PRIORITY}; | |||||||||||||||||||||||||||
| 97 | 0 | $self->{DELIVERY_MONITORING}=$args{DELIVERY_MONITORING}; | |||||||||||||||||||||||||||
| 98 | 0 | $self->{OBSOLESCENCE_PERIOD}=$args{OBSOLESCENCE_PERIOD}; | |||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | 0 | $self; | |||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||
| 103 | ########################################################################################################### | ||||||||||||||||||||||||||||
| 104 | 1 | 'Choppers rule'; | |||||||||||||||||||||||||||
| 105 | __END__ | ||||||||||||||||||||||||||||