File Coverage

blib/lib/WWW/Google/Places/SearchResult.pm
Criterion Covered Total %
statement 17 32 53.1
branch 0 2 0.0
condition n/a
subroutine 6 8 75.0
pod 0 2 0.0
total 23 44 52.2


line stmt bran cond sub pod time code
1             package WWW::Google::Places::SearchResult;
2              
3             $WWW::Google::Places::SearchResult::VERSION = '0.35';
4             $WWW::Google::Places::SearchResult::AUTHORITY = 'cpan:MANWAR';
5              
6             =head1 NAME
7              
8             WWW::Google::Places::SearchResult - Placeholder for Search Result for WWW::Google::Places.
9              
10             =head1 VERSION
11              
12             Version 0.35
13              
14             =cut
15              
16 8     8   155 use 5.006;
  8         30  
17 8     8   53 use Data::Dumper;
  8         27  
  8         412  
18 8     8   3557 use WWW::Google::Places::Geometry;
  8         35  
  8         235  
19              
20 8     8   53 use Moo;
  8         17  
  8         28  
21 8     8   2383 use namespace::clean;
  8         16  
  8         35  
22              
23 8     8   2068 use overload q{""} => 'as_string', fallback => 1;
  8         16  
  8         37  
24              
25             has 'place_id' => (is => 'ro');
26             has 'name' => (is => 'ro');
27             has 'types' => (is => 'ro');
28             has 'geometry' => (is => 'ro');
29             has 'icon' => (is => 'ro', default => sub { 'N/A' });
30             has 'vicinity' => (is => 'ro', default => sub { 'N/A' });
31             has 'scope' => (is => 'ro', default => sub { 'GOOGLE' });
32              
33             sub BUILDARGS {
34 0     0 0   my ($class, $args) = @_;
35              
36 0 0         if (exists $args->{geometry}) {
37 0           $args->{geometry} = WWW::Google::Places::Geometry->new($args->{geometry});
38             }
39              
40 0           return $args;
41             }
42              
43             =head1 METHODS
44              
45             =head2 place_id()
46              
47             Returns the place id.
48              
49             =head2 name()
50              
51             Returns place name.
52              
53             =head2 types()
54              
55             Returns ref to a list of place types.
56              
57             =head2 geometry()
58              
59             Returns an object of type L.
60              
61             =head2 icon()
62              
63             Returns URL of the link to the place icon.
64              
65             =head2 vicinity()
66              
67             Returns the vicinity of place.
68              
69             =head2 scope()
70              
71             Returns the place search scope.
72              
73             =cut
74              
75             sub as_string {
76 0     0 0   my ($self) = @_;
77              
78 0           my $search_result = '';
79 0           $search_result .= sprintf("Id : %s\n", $self->place_id);
80 0           $search_result .= sprintf("Name : %s\n", $self->name);
81 0           $search_result .= sprintf("Types : %s\n", join(", ", @{$self->types}));
  0            
82 0           $search_result .= sprintf("Geometry: %s\n", $self->geometry);
83 0           $search_result .= sprintf("Icon : %s\n", $self->icon);
84 0           $search_result .= sprintf("Vicinity: %s\n", $self->vicinity);
85 0           $search_result .= sprintf("Scope : %s", $self->scope);
86              
87 0           return $search_result;
88             }
89              
90             =head1 AUTHOR
91              
92             Mohammad S Anwar, C<< >>
93              
94             =head1 REPOSITORY
95              
96             L
97              
98             =head1 BUGS
99              
100             Please report any bugs or feature requests to C,
101             or through the web interface at L.
102             I will be notified, and then you'll automatically be notified of progress on your
103             bug as I make changes.
104              
105             =head1 SUPPORT
106              
107             You can find documentation for this module with the perldoc command.
108              
109             perldoc WWW::Google::Places::SearchResult
110              
111             You can also look for information at:
112              
113             =over 4
114              
115             =item * RT: CPAN's request tracker (report bugs here)
116              
117             L
118              
119             =item * AnnoCPAN: Annotated CPAN documentation
120              
121             L
122              
123             =item * CPAN Ratings
124              
125             L
126              
127             =item * Search CPAN
128              
129             L
130              
131             =back
132              
133             =head1 LICENSE AND COPYRIGHT
134              
135             Copyright (C) 2011 - 2016 Mohammad S Anwar.
136              
137             This program is free software; you can redistribute it and/or modify it under
138             the terms of the the Artistic License (2.0). You may obtain a copy of the full
139             license at:
140              
141             L
142              
143             Any use, modification, and distribution of the Standard or Modified Versions is
144             governed by this Artistic License.By using, modifying or distributing the Package,
145             you accept this license. Do not use, modify, or distribute the Package, if you do
146             not accept this license.
147              
148             If your Modified Version has been derived from a Modified Version made by someone
149             other than you,you are nevertheless required to ensure that your Modified Version
150             complies with the requirements of this license.
151              
152             This license does not grant you the right to use any trademark, service mark,
153             tradename, or logo of the Copyright Holder.
154              
155             This license includes the non-exclusive, worldwide, free-of-charge patent license
156             to make, have made, use, offer to sell, sell, import and otherwise transfer the
157             Package with respect to any patent claims licensable by the Copyright Holder that
158             are necessarily infringed by the Package. If you institute patent litigation
159             (including a cross-claim or counterclaim) against any party alleging that the
160             Package constitutes direct or contributory patent infringement,then this Artistic
161             License to you shall terminate on the date that such litigation is filed.
162              
163             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND
164             CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
165             WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
166             NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS
167             REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT,
168             INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
169             OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
170              
171             =cut
172              
173             1; # End of WWW::Google::Places::SearchResult