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