Places/DetailResult.pm

filter: Statementstmt 36.5% 50 / 137 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 47.3% 9 / 19 Podpod 0.0% 0 / 2 totaltotal 33.7% 59 / 175 SCAR 44.3
CC
15
Cov
33%
BUILDARGS
72.0
as_string
72.0
__ANON__
1.1
CRAP 83.6
↑ Summary Places.pm »
1 package WWW::Google::Places::DetailResult;
2  
3 8 $WWW::Google::Places::DetailResult::VERSION = '0.35';
4 8 $WWW::Google::Places::DetailResult::AUTHORITY = 'cpan:MANWAR';
5  
6 =head1 NAME
7  
8 WWW::Google::Places::DetailResult - Placeholder for detail Search Result for WWW::Google::Places.
9  
10 =head1 VERSION
11  
12 Version 0.35
13  
14 =cut
15  
16 8 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 8 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 8 ▶use WWW::Google::Places::Photo;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 8 ▶use WWW::Google::Places::Review;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 8 ▶use WWW::Google::Places::Address;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 8 ▶use WWW::Google::Places::Geometry;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 8 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 8 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
25  
26 8 ▶use overload q{""} => 'as_string', fallback => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
27  
28 8 has 'place_id' => (is => 'ro', required => 1 );
29 0 ▶has 'website' => (is => 'ro', default => sub { 'N/A' });
Subroutine __ANON__: not called CC=1 SCAR=1.2
30 0 ▶has 'formatted_phone_number' => (is => 'ro', default => sub { 'N/A' });
Subroutine __ANON__: not called CC=1 SCAR=1.2
31 0 ▶has 'opening_hours' => (is => 'ro', default => sub { 'N/A' });
Subroutine __ANON__: not called CC=1 SCAR=1.2
32 0 ▶has 'internation_number' => (is => 'ro', default => sub { 'N/A' });
Subroutine __ANON__: not called CC=1 SCAR=1.2
33 0 ▶has 'photos' => (is => 'ro', default => sub { 'N/A' });
Subroutine __ANON__: not called CC=1 SCAR=1.2
34 0 ▶has 'utf_offset' => (is => 'ro', default => sub { 'N/A' });
Subroutine __ANON__: not called CC=1 SCAR=1.2
35 0 ▶has 'rating' => (is => 'ro', default => sub { 'N/A' });
Subroutine __ANON__: not called CC=1 SCAR=1.2
36 0 ▶has 'user_ratings_total' => (is => 'ro', default => sub { 'N/A' });
Subroutine __ANON__: not called CC=1 SCAR=1.2
37 8 has 'reviews' => (is => 'ro');
38 8 has 'vicinity' => (is => 'ro');
39 8 has 'adr_address' => (is => 'ro');
40 8 has 'reference' => (is => 'ro');
41 8 has 'geometry' => (is => 'ro');
42 8 has 'scope' => (is => 'ro');
43 8 has 'icon' => (is => 'ro');
44 8 has 'name' => (is => 'ro');
45 8 has 'types' => (is => 'ro');
46 8 has 'formatted_address' => (is => 'ro');
47 8 has 'url' => (is => 'ro');
48 8 has 'address_components' => (is => 'ro');
49  
50 sub BUILDARGS {
51 0 ▶ my ($class, $args) = @_;
Subroutine BUILDARGS: not called CC=8 SCAR=42.8
Pod undocumented
52  
53 0 my $reviews = [];
54 0 ▶ if (exists $args->{reviews}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args->{'reviews'}) { } 0 0 0
55 0 foreach (@{$args->{reviews}}) {
56 0 push @$reviews, WWW::Google::Places::Review->new($_);
57 }
58 }
59 else {
60 0 push @$reviews, WWW::Google::Places::Review->new;
61 }
62  
63 0 $args->{reviews} = $reviews;
64  
65 0 ▶ if (exists $args->{geometry}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args->{"geometry"}) 0 0 0
66 0 $args->{geometry} = WWW::Google::Places::Geometry->new($args->{geometry});
67 }
68  
69 0 ▶ if (exists $args->{photos}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args->{"photos"}) 0 0 0
70 0 my $photos = [];
71 0 foreach (@{$args->{photos}}) {
72 0 push @$photos, WWW::Google::Places::Photo->new($_);
73 }
74  
75 0 $args->{photos} = $photos;
76 }
77  
78 0 ▶ if (exists $args->{address_components}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args->{"address_components"}) 0 0 0
79 0 my $address_components = [];
80 0 foreach (@{$args->{address_components}}) {
81 0 push @$address_components, WWW::Google::Places::Address->new($_);
82 }
83  
84 0 $args->{address_components} = $address_components;
85 }
86  
87 0 return $args;
88 }
89  
90 =head1 METHODS
91  
92 =head2 name()
93  
94 Returns place name.
95  
96 =head2 types()
97  
98 Returns ref to a list of place types as defined in the pod document of L<WWW::Google::Places>.
99  
100 =head2 url()
101  
102 Returns place URL.
103  
104 =head2 place_id()
105  
106 Returns place id.
107  
108 =head2 vicinity()
109  
110 =head2 website()
111  
112 Returns place website.
113  
114 =head2 formatted_phone_number()
115  
116 Returns place formatted phone number.
117  
118 =head2 adr_address()
119  
120 =head2 reference()
121  
122 Returns place reference.
123  
124 =head2 utf_offset()
125  
126 =head2 geometry()
127  
128 Returns an object of type L<WWW::Google::Places::Geometry>.
129  
130 =head2 scope()
131  
132 Returns place search scope.
133  
134 =head2 icon()
135  
136 Returns link to the place icon.
137  
138 =head2 reviews()
139  
140 Returns ref to a list of objects of type L<WWW::Google::Places::Review>.
141  
142 =head2 rating()
143  
144 Returns place rating.
145  
146 =head2 user_ratings_total()
147  
148 Retuns place total user ratings.
149  
150 =head2 formatted_address()
151  
152 Returns place address.
153  
154 =head2 address_components()
155  
156 Returns ref to a list of objects of type L<WWW::Google::Places::Address>.
157  
158 =head2 opening_hours()
159  
160 Returns place opening hours.
161  
162 =head2 internation_number()
163  
164 Returns place internation number.
165  
166 =head2 photos()
167  
168 Returns ref to a list of objects of type L<WWW::Google::Places::Photo>.
169  
170 =cut
171  
172 sub as_string {
173 0 ▶ my ($self) = @_;
Subroutine as_string: not called CC=8 SCAR=42.8
Pod undocumented
174  
175 0 my $detail_result = '';
176 0 $detail_result .= sprintf("Place ID : %s\n", $self->place_id);
177 0 $detail_result .= sprintf("Name : %s\n", $self->name);
178 0 $detail_result .= sprintf("Website : %s\n", $self->website);
179 0 $detail_result .= sprintf("URL : %s\n", $self->url);
180 0 $detail_result .= sprintf("Phone Number : %s\n", $self->formatted_phone_number);
181 0 $detail_result .= sprintf("Opening Hours : %s\n", $self->opening_hours);
182 0 $detail_result .= sprintf("Internation Number: %s\n", $self->internation_number);
183 0 $detail_result .= sprintf("UTF Offset : %s\n", $self->utf_offset);
184 0 $detail_result .= sprintf("Rating : %s\n", $self->rating);
185 0 $detail_result .= sprintf("User Ratings : %s\n", $self->user_ratings_total);
186 0 $detail_result .= sprintf("Vicinity : %s\n", $self->vicinity);
187 0 $detail_result .= sprintf("Address : %s\n", $self->adr_address);
188 0 $detail_result .= sprintf("Reference : %s\n", $self->reference);
189 0 $detail_result .= sprintf("Geometry : %s\n", $self->geometry);
190 0 $detail_result .= sprintf("Scope : %s\n", $self->scope);
191 0 $detail_result .= sprintf("Icon : %s\n", $self->icon);
192 0 $detail_result .= sprintf("Types : %s\n", join(", ", @{$self->types}));
193 0 $detail_result .= sprintf("Address : %s\n", $self->formatted_address);
194  
195 0 ▶ if (@{$self->address_components}) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self->address_components;}) 0 0 0
196 0 $detail_result .= sprintf("Address Components:\n");
197 0 foreach (@{$self->address_components}) {
198 0 $detail_result .= sprintf("\tShort Name: %s\n", $_->short_name);
199 0 $detail_result .= sprintf("\tLong Name : %s\n", $_->long_name);
200 0 $detail_result .= sprintf("\tTypes : %s\n", join(", ", @{$_->types}));
201 0 $detail_result .= sprintf("\t-----------\n");
202 }
203 }
204  
205 0 ▶ if (@{$self->reviews}) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self->reviews;}) 0 0 0
206 0 $detail_result .= sprintf("Reviews :\n");
207 0 foreach (@{$self->reviews}) {
208 0 $detail_result .= sprintf("\tAuthor Name: %s\n", $_->author_name);
209 0 $detail_result .= sprintf("\tAuthor URL : %s\n", $_->author_url);
210 0 $detail_result .= sprintf("\tLanguage : %s\n", $_->language);
211 0 $detail_result .= sprintf("\tRating : %s\n", $_->rating);
212 0 $detail_result .= sprintf("\tText : %s\n", $_->text);
213 0 $detail_result .= sprintf("\tTime : %s\n", $_->time);
214 0 ▶ $detail_result .= sprintf("\tAspects : %s\n", $_->aspects||'N/A');
Condition0%0/2
$_->aspects || 'N/A'
l!l
00
MC/DC0%0/1
$_->aspects || 'N/A'
$_->aspects
Truth table0%0/2
A
A= $_->aspects
Aresult
11
00
215 0 $detail_result .= sprintf("\t-----------\n");
216 }
217 }
218 0 ▶ if (@{$self->photos}) {
Branch: 1 branch
BranchTrueFalseTotal
if (@{$self->photos;}) 0 0 0
219 0 $detail_result .= sprintf("Photos : \n");
220 0 foreach (@{$self->photos}) {
221 0 $detail_result .= sprintf("\tWidth :%s\n", $_->width);
222 0 $detail_result .= sprintf("\tHeight :%s\n", $_->height);
223 0 $detail_result .= sprintf("\tReference :%s\n", $_->photo_reference);
224 0 $detail_result .= sprintf("\tHTML Attributions :%s\n", join("<BR", @{$_->html_attributions}));
225 0 $detail_result .= sprintf("\t-------------------\n");
226 }
227 }
228  
229 0 return $detail_result;
230 }
231  
232 =head1 AUTHOR
233  
234 Mohammad S Anwar, C<< <mohammad.anwar at yahoo.com> >>
235  
236 =head1 REPOSITORY
237  
238 L<https://github.com/manwar/WWW-Google-Places>
239  
240 =head1 BUGS
241  
242 Please report any bugs or feature requests to C<bug-www-google-places at rt.cpan.org>,
243 or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=WWW-Google-Places>.
244 I will be notified, and then you'll automatically be notified of progress on your
245 bug as I make changes.
246  
247 =head1 SUPPORT
248  
249 You can find documentation for this module with the perldoc command.
250  
251 perldoc WWW::Google::Places::DetailResult
252  
253 You can also look for information at:
254  
255 =over 4
256  
257 =item * RT: CPAN's request tracker (report bugs here)
258  
259 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=WWW-Google-Places>
260  
261 =item * AnnoCPAN: Annotated CPAN documentation
262  
263 L<http://annocpan.org/dist/WWW-Google-Places>
264  
265 =item * CPAN Ratings
266  
267 L<http://cpanratings.perl.org/d/WWW-Google-Places>
268  
269 =item * Search CPAN
270  
271 L<http://search.cpan.org/dist/WWW-Google-Places/>
272  
273 =back
274  
275 =head1 LICENSE AND COPYRIGHT
276  
277 Copyright (C) 2011 - 2016 Mohammad S Anwar.
278  
279 This program is free software; you can redistribute it and / or modify it under
280 the terms of the the Artistic License (2.0). You may obtain a copy of the full
281 license at:
282  
283 L<http://www.perlfoundation.org/artistic_license_2_0>
284  
285 Any use, modification, and distribution of the Standard or Modified Versions is
286 governed by this Artistic License.By using, modifying or distributing the Package,
287 you accept this license. Do not use, modify, or distribute the Package, if you do
288 not accept this license.
289  
290 If your Modified Version has been derived from a Modified Version made by someone
291 other than you,you are nevertheless required to ensure that your Modified Version
292 complies with the requirements of this license.
293  
294 This license does not grant you the right to use any trademark, service mark,
295 tradename, or logo of the Copyright Holder.
296  
297 This license includes the non-exclusive, worldwide, free-of-charge patent license
298 to make, have made, use, offer to sell, sell, import and otherwise transfer the
299 Package with respect to any patent claims licensable by the Copyright Holder that
300 are necessarily infringed by the Package. If you institute patent litigation
301 (including a cross-claim or counterclaim) against any party alleging that the
302 Package constitutes direct or contributory patent infringement,then this Artistic
303 License to you shall terminate on the date that such litigation is filed.
304  
305 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND
306 CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
307 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
308 NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS
309 REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT,
310 INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
311 OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
312  
313 =cut
314  
315 8 1; # End of WWW::Google::Places::DetailResult
↑ Summary Places.pm »