line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package BankAccount::Validator::UK::Rule; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$BankAccount::Validator::UK::Rule::VERSION = '0.63'; |
4
|
|
|
|
|
|
|
$BankAccount::Validator::UK::Rule::AUTHORITY = 'cpan:MANWAR'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
BankAccount::Validator::UK::Rule - Rules for validating UK bank account. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Version 0.63 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
3
|
|
|
3
|
|
52
|
use 5.006; |
|
3
|
|
|
|
|
9
|
|
17
|
3
|
|
|
3
|
|
14
|
use strict; use warnings; |
|
3
|
|
|
3
|
|
5
|
|
|
3
|
|
|
|
|
50
|
|
|
3
|
|
|
|
|
10
|
|
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
63
|
|
18
|
3
|
|
|
3
|
|
1063
|
use autodie; |
|
3
|
|
|
|
|
37287
|
|
|
3
|
|
|
|
|
13
|
|
19
|
3
|
|
|
3
|
|
16881
|
use File::ShareDir ':ALL'; |
|
3
|
|
|
|
|
65388
|
|
|
3
|
|
|
|
|
1862
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head1 DESCRIPTION |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
B |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 METHODS |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head2 get_sort_codes() |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
It is used by the module L internally. It returns the |
30
|
|
|
|
|
|
|
substituting sort code if found, as provided by VOCALINK in the document dated |
31
|
|
|
|
|
|
|
13th June'2005. The document is called scsubtab.txt. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub get_sort_codes { |
36
|
|
|
|
|
|
|
|
37
|
36
|
|
|
36
|
1
|
85
|
my $sort_codes = {}; |
38
|
36
|
|
|
|
|
199
|
my $file_name = dist_file('BankAccount-Validator-UK', 'scsubtab.txt'); |
39
|
|
|
|
|
|
|
|
40
|
36
|
|
|
|
|
6602
|
open(my $SOURCE, "<", $file_name); |
41
|
36
|
|
|
|
|
11174
|
while (my $row = <$SOURCE>) { |
42
|
756
|
|
|
|
|
941
|
chomp $row; |
43
|
756
|
|
|
|
|
1595
|
my ($left, $right) = split /\s/, $row, 2; |
44
|
756
|
|
|
|
|
1137
|
$left =~ s/^\s+//g; |
45
|
756
|
|
|
|
|
924
|
$left =~ s/\s+$//g; |
46
|
756
|
|
|
|
|
867
|
$right =~ s/^\s+//g; |
47
|
756
|
|
|
|
|
809
|
$right =~ s/\s+$//g; |
48
|
|
|
|
|
|
|
|
49
|
756
|
50
|
33
|
|
|
2226
|
if (($left =~ /^\d+$/) && ($right =~ /^\d+$/)) { |
50
|
756
|
|
|
|
|
2245
|
$sort_codes->{$left} = $right; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
36
|
|
|
|
|
195
|
close($SOURCE); |
54
|
|
|
|
|
|
|
|
55
|
36
|
|
|
|
|
4046
|
return $sort_codes; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 get_rules() |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
It is used by the module L internally.It returns every |
61
|
|
|
|
|
|
|
possible rules cover by the document, as provided by VOCALINK dated 24th Dec 2021 |
62
|
|
|
|
|
|
|
and is called valacdos.txt. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub get_rules { |
67
|
|
|
|
|
|
|
|
68
|
35
|
|
|
35
|
1
|
58
|
my $rules; |
69
|
35
|
|
|
|
|
68
|
foreach (@{_raw_data()}) { |
|
35
|
|
|
|
|
110
|
|
70
|
39480
|
|
|
|
|
106635
|
my @values = split ' '; |
71
|
39480
|
|
|
|
|
46298
|
my $value_of = {}; |
72
|
39480
|
|
|
|
|
41858
|
my $index = 0; |
73
|
39480
|
|
|
|
|
48918
|
foreach my $k (qw(start end mod u v w x y z a b c d e f g h)) { |
74
|
671160
|
|
|
|
|
820694
|
$values[$index] =~ s/^\s+//g; |
75
|
671160
|
|
|
|
|
737364
|
$values[$index] =~ s/\s+$//g; |
76
|
671160
|
100
|
|
|
|
796250
|
if ($index == 2) { |
77
|
39480
|
|
|
|
|
60397
|
$value_of->{$k} = $values[$index]; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
else { |
80
|
631680
|
|
|
|
|
859446
|
$value_of->{$k} = $values[$index] + 0; |
81
|
|
|
|
|
|
|
} |
82
|
671160
|
|
|
|
|
720668
|
$index++; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
39480
|
100
|
|
|
|
50531
|
if (!$values[$index]) { |
86
|
18060
|
|
|
|
|
21567
|
$value_of->{'ex'} = 0; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
else { |
89
|
21420
|
|
|
|
|
29324
|
$value_of->{'ex'} = $values[$index] + 0; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
39480
|
|
|
|
|
89252
|
push @$rules, $value_of; |
93
|
|
|
|
|
|
|
} |
94
|
|
|
|
|
|
|
|
95
|
35
|
|
|
|
|
4439
|
return $rules; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
sub _raw_data { |
99
|
|
|
|
|
|
|
|
100
|
35
|
|
|
35
|
|
90
|
my $raw_data = []; |
101
|
35
|
|
|
|
|
103
|
my $file_name = dist_file('BankAccount-Validator-UK', 'valacdos.txt'); |
102
|
|
|
|
|
|
|
|
103
|
35
|
|
|
|
|
4720
|
open(my $SOURCE, "<", $file_name); |
104
|
35
|
|
|
|
|
3304
|
while (my $row = <$SOURCE>) { |
105
|
39480
|
|
|
|
|
40661
|
chomp $row; |
106
|
39480
|
|
|
|
|
71456
|
push @$raw_data, $row; |
107
|
|
|
|
|
|
|
} |
108
|
35
|
|
|
|
|
268
|
close($SOURCE); |
109
|
|
|
|
|
|
|
|
110
|
35
|
|
|
|
|
2818
|
return $raw_data; |
111
|
|
|
|
|
|
|
} |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head1 AUTHOR |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
Mohammad S Anwar, C<< >> |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 REPOSITORY |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
L |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 BUGS |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Please report any bugs or feature requests to C
|
124
|
|
|
|
|
|
|
rt.cpan.org>, or through the web interface at L. |
125
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on your |
126
|
|
|
|
|
|
|
bug as I make changes. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head1 SUPPORT |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
perldoc BankAccount::Validator::UK::Rule |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
You can also look for information at: |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=over 4 |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
L |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
L |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item * CPAN Ratings |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
L |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item * Search CPAN |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
L |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
=back |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Copyright (C) 2012 - 2017 Mohammad S Anwar. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
This program is free software; you can redistribute it and / or modify it under |
161
|
|
|
|
|
|
|
the terms of the the Artistic License (2.0). You may obtain a copy of the full |
162
|
|
|
|
|
|
|
license at: |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
L |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Any use, modification, and distribution of the Standard or Modified Versions is |
167
|
|
|
|
|
|
|
governed by this Artistic License.By using, modifying or distributing the Package, |
168
|
|
|
|
|
|
|
you accept this license. Do not use, modify, or distribute the Package, if you do |
169
|
|
|
|
|
|
|
not accept this license. |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
If your Modified Version has been derived from a Modified Version made by someone |
172
|
|
|
|
|
|
|
other than you,you are nevertheless required to ensure that your Modified Version |
173
|
|
|
|
|
|
|
complies with the requirements of this license. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
This license does not grant you the right to use any trademark, service mark, |
176
|
|
|
|
|
|
|
tradename, or logo of the Copyright Holder. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
This license includes the non-exclusive, worldwide, free-of-charge patent license |
179
|
|
|
|
|
|
|
to make, have made, use, offer to sell, sell, import and otherwise transfer the |
180
|
|
|
|
|
|
|
Package with respect to any patent claims licensable by the Copyright Holder that |
181
|
|
|
|
|
|
|
are necessarily infringed by the Package. If you institute patent litigation |
182
|
|
|
|
|
|
|
(including a cross-claim or counterclaim) against any party alleging that the |
183
|
|
|
|
|
|
|
Package constitutes direct or contributory patent infringement,then this Artistic |
184
|
|
|
|
|
|
|
License to you shall terminate on the date that such litigation is filed. |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND |
187
|
|
|
|
|
|
|
CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED |
188
|
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR |
189
|
|
|
|
|
|
|
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS |
190
|
|
|
|
|
|
|
REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, |
191
|
|
|
|
|
|
|
INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE |
192
|
|
|
|
|
|
|
OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=cut |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
1; # End of BankAccount::Validator::UK::Rule |