Places/Params.pm

filter: Statementstmt 100% 30 / 30 Branchbran n/a Conditioncond 83.3% 10 / 12 MC/DCmcdc 60.0% 3 / 5 Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 1 totaltotal 91.2% 52 / 57 SCAR 16.1
CC
5
Cov
95%
_check_location
5.1
BEGIN
1.0
BEGIN
1.0
CRAP 5.0
« Places.pm ↑ Summary Places/Review.pm »
1 package WWW::Google::Places::Params;
2  
3 8 $WWW::Google::Places::Params::VERSION = '0.35';
4 8 $WWW::Google::Places::Params::AUTHORITY = 'cpan:MANWAR';
5  
6 =head1 NAME
7  
8 WWW::Google::Places::Params - Placeholder for parameters for WWW::Google::Places
9  
10 =head1 VERSION
11  
12 Version 0.35
13  
14 =head1 DESCRIPTION
15  
16 B<FOR INTERNAL USE ONLY>
17  
18 =cut
19  
20 8 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 8 ▶use strict; use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
22 8 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 8 ▶use File::Share ':all';
Subroutine BEGIN: called CC=1 SCAR=0.0
25 8 ▶use Method::ParamValidator;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 8 ▶use parent 'Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
28 8 our @EXPORT_OK = qw(get_validator);
29  
30 sub get_validator {
31 3 ▶ my $validator = Method::ParamValidator->new( config => dist_file('WWW-Google-Places', 'method-config.json') );
Subroutine get_validator: called CC=1 SCAR=0.0
Pod undocumented
32 3 $validator->get_field('location')->check(\&_check_location);
33  
34 3 return $validator;
35 }
36  
37 #
38 #
39 # PRIVATE METHODS
40 sub _check_location {
41 5 ▶ my ($location) = @_;
Subroutine _check_location: called CC=5 SCAR=16.2
42  
43 5 my ($latitude, $longitude);
44 5 ▶ return (defined $location
Condition83%10/12
defined $location && $location =~ /\,/ && ((() = split(/\,/, $location, 2)) && ($latitude =~ /^\-?\d+\.?\d+$/ && $longitude =~ /^\-?\d+\.?\d+$/))
!ll&&!rl&&r
131
defined $location and $location =~ /\,/
!ll&&!rl&&r
014
() = split(/\,/, $location, 2) and ($latitude =~ /^\-?\d+\.?\d+$/ and $longitude =~ /^\-?\d+\.?\d+$/)
!ll&&!rl&&r
031
$latitude =~ /^\-?\d+\.?\d+$/ and $longitude =~ /^\-?\d+\.?\d+$/
!ll&&!rl&&r
121
MC/DC60%3/5
defined $location && $location =~ /\,/ && ((() = split(/\,/, $location, 2)) && ($latitude =~ /^\-?\d+\.?\d+$/ && $longitude =~ /^\-?\d+\.?\d+$/))
defined $location $location =~ /\,/ () = split(/\,/, $location, 2) $latitude =~ /^\-?\d+\.?\d+$/ $longitude =~ /^\-?\d+\.?\d+$/
Truth table66%4/6
A and B && C and D and E
A= defined $locationB= $location =~ /\,/C= () = split(/\,/, $location, 2)D= $latitude =~ /^\-?\d+\.?\d+$/E= $longitude =~ /^\-?\d+\.?\d+$/
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
45 &&
46 ($location =~ /\,/)
47 &&
48 ((($latitude, $longitude) = split/\,/,$location,2)
49 &&
50 (($latitude =~ /^\-?\d+\.?\d+$/) && ($longitude =~ /^\-?\d+\.?\d+$/))
51 ));
52 };
53  
54 =head1 AUTHOR
55  
56 Mohammad S Anwar, C<< <mohammad.anwar at yahoo.com> >>
57  
58 =head1 REPOSITORY
59  
60 L<https://github.com/manwar/WWW-Google-Places>
61  
62 =head1 BUGS
63  
64 Please report any bugs or feature requests to C<bug-www-google-places at rt.cpan.org>,
65 or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Google-Places>.
66 I will be notified, and then you'll automatically be notified of progress on your
67 bug as I make changes.
68  
69 =head1 SUPPORT
70  
71 You can find documentation for this module with the perldoc command.
72  
73 perldoc WWW::Google::Places::Params
74  
75 You can also look for information at:
76  
77 =over 4
78  
79 =item * RT: CPAN's request tracker (report bugs here)
80  
81 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Google-Places>
82  
83 =item * AnnoCPAN: Annotated CPAN documentation
84  
85 L<http://annocpan.org/dist/WWW-Google-Places>
86  
87 =item * CPAN Ratings
88  
89 L<http://cpanratings.perl.org/d/WWW-Google-Places>
90  
91 =item * Search CPAN
92  
93 L<http://search.cpan.org/dist/WWW-Google-Places/>
94  
95 =back
96  
97 =head1 LICENSE AND COPYRIGHT
98  
99 Copyright (C) 2011 - 2016 Mohammad S Anwar.
100  
101 This program is free software; you can redistribute it and/or modify it under
102 the terms of the the Artistic License (2.0). You may obtain a copy of the full
103 license at:
104  
105 L<http://www.perlfoundation.org/artistic_license_2_0>
106  
107 Any use, modification, and distribution of the Standard or Modified Versions is
108 governed by this Artistic License.By using, modifying or distributing the Package,
109 you accept this license. Do not use, modify, or distribute the Package, if you do
110 not accept this license.
111  
112 If your Modified Version has been derived from a Modified Version made by someone
113 other than you,you are nevertheless required to ensure that your Modified Version
114 complies with the requirements of this license.
115  
116 This license does not grant you the right to use any trademark, service mark,
117 tradename, or logo of the Copyright Holder.
118  
119 This license includes the non-exclusive, worldwide, free-of-charge patent license
120 to make, have made, use, offer to sell, sell, import and otherwise transfer the
121 Package with respect to any patent claims licensable by the Copyright Holder that
122 are necessarily infringed by the Package. If you institute patent litigation
123 (including a cross-claim or counterclaim) against any party alleging that the
124 Package constitutes direct or contributory patent infringement,then this Artistic
125 License to you shall terminate on the date that such litigation is filed.
126  
127 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND
128 CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
129 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
130 NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS
131 REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT,
132 INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
133 OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
134  
135 =cut
136  
137 8 1; # End of WWW::Google::Places::Params
« Places.pm ↑ Summary Places/Review.pm »