line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Address::PostCode::Australia::Params; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$Address::PostCode::Australia::Params::VERSION = '0.12'; |
4
|
|
|
|
|
|
|
$Address::PostCode::Australia::Params::AUTHORITY = 'cpan:MANWAR'; |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Address::PostCode::Australia::Params - Placeholder for parameters for Address::PostCode::Australia |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Version 0.12 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
B |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
4
|
|
|
4
|
|
59
|
use 5.006; |
|
4
|
|
|
|
|
14
|
|
21
|
4
|
|
|
4
|
|
16
|
use strict; use warnings; |
|
4
|
|
|
4
|
|
7
|
|
|
4
|
|
|
|
|
71
|
|
|
4
|
|
|
|
|
16
|
|
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
76
|
|
22
|
4
|
|
|
4
|
|
19
|
use Data::Dumper; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
174
|
|
23
|
4
|
|
|
4
|
|
1489
|
use parent 'Exporter'; |
|
4
|
|
|
|
|
1108
|
|
|
4
|
|
|
|
|
20
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our @EXPORT_OK = qw(validate); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub check_num { |
28
|
0
|
|
|
0
|
0
|
0
|
my ($num) = @_; |
29
|
|
|
|
|
|
|
|
30
|
0
|
0
|
0
|
|
|
0
|
die "ERROR: Invalid NUM data type [$num]" |
31
|
|
|
|
|
|
|
unless (defined $num && $num =~ /^\d+$/); |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub check_str { |
35
|
0
|
|
|
0
|
0
|
0
|
my ($str) = @_; |
36
|
|
|
|
|
|
|
|
37
|
0
|
0
|
0
|
|
|
0
|
die "ERROR: Invalid STR data type [$str]" |
38
|
|
|
|
|
|
|
if (defined $str && $str =~ /^\d+$/); |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
our $FIELDS = { |
42
|
|
|
|
|
|
|
'postcode' => { check => sub { check_num(@_) }, type => 'd' }, |
43
|
|
|
|
|
|
|
'location' => { check => sub { check_str(@_) }, type => 's' }, |
44
|
|
|
|
|
|
|
'state' => { check => sub { check_str(@_) }, type => 's' }, |
45
|
|
|
|
|
|
|
}; |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub validate { |
48
|
5
|
|
|
5
|
0
|
8
|
my ($fields, $values) = @_; |
49
|
|
|
|
|
|
|
|
50
|
5
|
100
|
|
|
|
17
|
die "ERROR: Missing params list." unless (defined $values); |
51
|
|
|
|
|
|
|
|
52
|
4
|
100
|
|
|
|
27
|
die "ERROR: Parameters have to be hash ref" unless (ref($values) eq 'HASH'); |
53
|
|
|
|
|
|
|
|
54
|
1
|
|
|
|
|
2
|
foreach my $field (keys %{$fields}) { |
|
1
|
|
|
|
|
5
|
|
55
|
|
|
|
|
|
|
die "ERROR: Received invalid param: $field" |
56
|
3
|
50
|
|
|
|
7
|
unless (exists $FIELDS->{$field}); |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
die "ERROR: Missing mandatory param: $field" |
59
|
3
|
50
|
33
|
|
|
7
|
if ($fields->{$field} && !exists $values->{$field}); |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
die "ERROR: Received undefined mandatory param: $field" |
62
|
3
|
50
|
33
|
|
|
8
|
if ($fields->{$field} && !defined $values->{$field}); |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
$FIELDS->{$field}->{check}->($values->{$field}) |
65
|
3
|
50
|
|
|
|
6
|
if defined $values->{$field}; |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 AUTHOR |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Mohammad S Anwar, C<< >> |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 REPOSITORY |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
L |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=head1 BUGS |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
Please report any bugs or feature requests to C, |
80
|
|
|
|
|
|
|
or through the web interface at L. |
81
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on your |
82
|
|
|
|
|
|
|
bug as I make changes. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 SUPPORT |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
perldoc Address::PostCode::Australia::Params |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
You can also look for information at: |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=over 4 |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
L |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
L |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=item * CPAN Ratings |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
L |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=item * Search CPAN |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
L |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=back |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Copyright (C) 2014 - 2015 Mohammad S Anwar. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This program is free software; you can redistribute it and / or modify it under |
117
|
|
|
|
|
|
|
the terms of the the Artistic License (2.0). You may obtain a copy of the full |
118
|
|
|
|
|
|
|
license at: |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
L |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
Any use, modification, and distribution of the Standard or Modified Versions is |
123
|
|
|
|
|
|
|
governed by this Artistic License.By using, modifying or distributing the Package, |
124
|
|
|
|
|
|
|
you accept this license. Do not use, modify, or distribute the Package, if you do |
125
|
|
|
|
|
|
|
not accept this license. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
If your Modified Version has been derived from a Modified Version made by someone |
128
|
|
|
|
|
|
|
other than you,you are nevertheless required to ensure that your Modified Version |
129
|
|
|
|
|
|
|
complies with the requirements of this license. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This license does not grant you the right to use any trademark, service mark, |
132
|
|
|
|
|
|
|
tradename, or logo of the Copyright Holder. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
This license includes the non-exclusive, worldwide, free-of-charge patent license |
135
|
|
|
|
|
|
|
to make, have made, use, offer to sell, sell, import and otherwise transfer the |
136
|
|
|
|
|
|
|
Package with respect to any patent claims licensable by the Copyright Holder that |
137
|
|
|
|
|
|
|
are necessarily infringed by the Package. If you institute patent litigation |
138
|
|
|
|
|
|
|
(including a cross-claim or counterclaim) against any party alleging that the |
139
|
|
|
|
|
|
|
Package constitutes direct or contributory patent infringement,then this Artistic |
140
|
|
|
|
|
|
|
License to you shall terminate on the date that such litigation is filed. |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND |
143
|
|
|
|
|
|
|
CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED |
144
|
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR |
145
|
|
|
|
|
|
|
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS |
146
|
|
|
|
|
|
|
REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, |
147
|
|
|
|
|
|
|
INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE |
148
|
|
|
|
|
|
|
OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=cut |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
1; # End of Address::PostCode::Australia::Params |