line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::ValidateBankAccount; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$App::ValidateBankAccount::VERSION = '0.10'; |
4
|
|
|
|
|
|
|
$App::ValidateBankAccount::AUTHORITY = 'cpan:MANWAR'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
App::ValidateBankAccount - App to validate bank account number. |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Version 0.10 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
2
|
|
82882
|
use 5.006; |
|
2
|
|
|
|
|
13
|
|
17
|
2
|
|
|
2
|
|
1033
|
use Data::Dumper; |
|
2
|
|
|
|
|
15732
|
|
|
2
|
|
|
|
|
118
|
|
18
|
2
|
|
|
2
|
|
1016
|
use BankAccount::Validator::UK; |
|
2
|
|
|
|
|
240325
|
|
|
2
|
|
|
|
|
68
|
|
19
|
2
|
|
|
2
|
|
1333
|
use App::ValidateBankAccount::Option; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
81
|
|
20
|
2
|
|
|
2
|
|
16
|
use Moo; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
11
|
|
21
|
2
|
|
|
2
|
|
555
|
use namespace::autoclean; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
10
|
|
22
|
2
|
|
|
2
|
|
122
|
use MooX::Options; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
9
|
|
23
|
|
|
|
|
|
|
with 'App::ValidateBankAccount::Option'; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our $DEFAULT_COUNTRY = 'uk'; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head1 DESCRIPTION |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
It provides command line interface to the distribution L. |
30
|
|
|
|
|
|
|
The distribution installs script C for you to play with. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 SYNOPSIS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
You can list all command line options by giving C<-h> flag. |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
USAGE: validate-bank-account [-h] [long options...] |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
--country=String Country code. Default is UK. |
39
|
|
|
|
|
|
|
--sort_code=String Sort Code (required). |
40
|
|
|
|
|
|
|
--account_number=String Bank Account Number (required). |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
--usage show a short help message |
43
|
|
|
|
|
|
|
-h show a compact help message |
44
|
|
|
|
|
|
|
--help show a long help message |
45
|
|
|
|
|
|
|
--man show the manual |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 SUPPORTED COUNTRIES |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 UNITED KINGDOM |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head3 BANKS |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=over 4 |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=item * Allied Irish |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=item * Bank of England |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=item * Bank of Ireland |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=item * Bank of Scotland |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=item * Barclays |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=item * Bradford and Bingley Building Society |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=item * Charity Bank |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=item * Citibank |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=item * Clear Bank |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=item * Clydesdale |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=item * Contis Financial Services |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item * Co-Operative Bank |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=item * Coutts |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=item * First Trust |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=item * Halifax |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item * Hoares Bank |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item * HSBC |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item * Lloyds |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=item * Metro Bank |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=item * NatWest |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=item * Nationwide Building Society |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=item * Northern |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=item * Orwell Union Ltd. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=item * Royal Bank of Scotland |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item * Santander |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
=item * Secure Trust |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item * Starling Bank |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=item * Tesco Bank |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item * TSB |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=item * Ulster Bank |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=item * Unity Trust Bank |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item * Virgin Bank |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=item * Williams & Glyn |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=item * Woolwich |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=item * Yorkshire Bank |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=back |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 METHODS |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 run() |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This is the only method provided by the package L.It does |
132
|
|
|
|
|
|
|
not expect any parameter. Code from the supplied C script. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
use strict; use warnings; |
135
|
|
|
|
|
|
|
use App::ValidateBankAccount; |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
App::ValidateBankAccount->new_with_options->run; |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=cut |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
sub run { |
142
|
1
|
|
|
1
|
1
|
3410
|
my ($self) = @_; |
143
|
|
|
|
|
|
|
|
144
|
1
|
|
|
|
|
5
|
my $country = $self->country; |
145
|
1
|
|
|
|
|
3
|
my $sort_code = $self->sort_code; |
146
|
1
|
|
|
|
|
4
|
my $account_number = $self->account_number; |
147
|
|
|
|
|
|
|
|
148
|
1
|
50
|
|
|
|
2
|
$country = $DEFAULT_COUNTRY unless defined $country; |
149
|
|
|
|
|
|
|
|
150
|
1
|
|
|
|
|
6
|
$sort_code =~ s/[\-\s]+//g; |
151
|
1
|
50
|
|
|
|
6
|
unless ($sort_code =~ /^\d+$/) { |
152
|
0
|
|
|
|
|
0
|
print sprintf("Sorry, %s is an invalid sort code.\n", $self->sort_code); |
153
|
0
|
|
|
|
|
0
|
return; |
154
|
|
|
|
|
|
|
} |
155
|
|
|
|
|
|
|
|
156
|
1
|
|
|
|
|
3
|
$account_number =~ s/\s+//g; |
157
|
1
|
50
|
|
|
|
3
|
unless ($account_number =~ /^\d+$/) { |
158
|
0
|
|
|
|
|
0
|
print sprintf("Sorry, %s is an invalid account number.\n", $self->account_number); |
159
|
0
|
|
|
|
|
0
|
return; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
1
|
50
|
|
|
|
4
|
if ($country eq $DEFAULT_COUNTRY) { |
163
|
|
|
|
|
|
|
|
164
|
1
|
|
|
|
|
7
|
my $validator = BankAccount::Validator::UK->new; |
165
|
1
|
50
|
|
|
|
5441
|
if ($validator->is_valid($sort_code, $account_number)) { |
166
|
1
|
|
|
|
|
116142
|
print sprintf("[%s][%s] is a valid bank account.\n", $self->sort_code, $self->account_number); |
167
|
|
|
|
|
|
|
} |
168
|
|
|
|
|
|
|
else { |
169
|
0
|
|
|
|
|
|
print sprintf("Sorry, [%s][%s] is an invalid bank account.\n", $self->sort_code, $self->account_number); |
170
|
|
|
|
|
|
|
} |
171
|
|
|
|
|
|
|
} |
172
|
|
|
|
|
|
|
else { |
173
|
0
|
|
|
|
|
|
print sprintf("Sorry, %s is not currently supported.\n", $country); |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
} |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
# |
178
|
|
|
|
|
|
|
# |
179
|
|
|
|
|
|
|
# PRIVATE METHODS |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
=head1 AUTHOR |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
Mohammad S Anwar, C<< >> |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=head1 REPOSITORY |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
L |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head1 BUGS |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, |
192
|
|
|
|
|
|
|
or through the web interface at L. |
193
|
|
|
|
|
|
|
I will be notified and then you'll automatically be notified of progress on your |
194
|
|
|
|
|
|
|
bug as I make changes. |
195
|
|
|
|
|
|
|
|
196
|
|
|
|
|
|
|
=head1 SUPPORT |
197
|
|
|
|
|
|
|
|
198
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
perldoc App::ValidateBankAccount |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
You can also look for information at: |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
=over 4 |
205
|
|
|
|
|
|
|
|
206
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
207
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
L |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
211
|
|
|
|
|
|
|
|
212
|
|
|
|
|
|
|
L |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
=item * CPAN Ratings |
215
|
|
|
|
|
|
|
|
216
|
|
|
|
|
|
|
L |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=item * Search CPAN |
219
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
L |
221
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=back |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
225
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
Copyright (C) 2019 Mohammad S Anwar. |
227
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
This program is free software; you can redistribute it and / or modify it under |
229
|
|
|
|
|
|
|
the terms of the the Artistic License (2.0). You may obtain a copy of the full |
230
|
|
|
|
|
|
|
license at: |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
L |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
Any use, modification, and distribution of the Standard or Modified Versions is |
235
|
|
|
|
|
|
|
governed by this Artistic License.By using, modifying or distributing the Package, |
236
|
|
|
|
|
|
|
you accept this license. Do not use, modify, or distribute the Package, if you do |
237
|
|
|
|
|
|
|
not accept this license. |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
If your Modified Version has been derived from a Modified Version made by someone |
240
|
|
|
|
|
|
|
other than you,you are nevertheless required to ensure that your Modified Version |
241
|
|
|
|
|
|
|
complies with the requirements of this license. |
242
|
|
|
|
|
|
|
|
243
|
|
|
|
|
|
|
This license does not grant you the right to use any trademark, service mark, |
244
|
|
|
|
|
|
|
tradename, or logo of the Copyright Holder. |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
This license includes the non-exclusive, worldwide, free-of-charge patent license |
247
|
|
|
|
|
|
|
to make, have made, use, offer to sell, sell, import and otherwise transfer the |
248
|
|
|
|
|
|
|
Package with respect to any patent claims licensable by the Copyright Holder that |
249
|
|
|
|
|
|
|
are necessarily infringed by the Package. If you institute patent litigation |
250
|
|
|
|
|
|
|
(including a cross-claim or counterclaim) against any party alleging that the |
251
|
|
|
|
|
|
|
Package constitutes direct or contributory patent infringement,then this Artistic |
252
|
|
|
|
|
|
|
License to you shall terminate on the date that such litigation is filed. |
253
|
|
|
|
|
|
|
|
254
|
|
|
|
|
|
|
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND |
255
|
|
|
|
|
|
|
CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED |
256
|
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR |
257
|
|
|
|
|
|
|
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS |
258
|
|
|
|
|
|
|
REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, |
259
|
|
|
|
|
|
|
INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE |
260
|
|
|
|
|
|
|
OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=cut |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
1; # End of App::ValidateBankAccount |