File Coverage

blib/lib/WebService/Wikimapia/Place.pm
Criterion Covered Total %
statement 26 102 25.4
branch 0 26 0.0
condition n/a
subroutine 9 10 90.0
pod 0 1 0.0
total 35 139 25.1


line stmt bran cond sub pod time code
1             package WebService::Wikimapia::Place;
2              
3             $WebService::Wikimapia::Place::VERSION = '0.14';
4             $WebService::Wikimapia::Place::AUTHORITY = 'cpan:MANWAR';
5              
6             =head1 NAME
7              
8             WebService::Wikimapia::Place - Placeholder for 'place' of L.
9              
10             =head1 VERSION
11              
12             Version 0.14
13              
14             =cut
15              
16 7     7   110 use 5.006;
  7         22  
17 7     7   31 use Data::Dumper;
  7         11  
  7         273  
18 7     7   2492 use WebService::Wikimapia::Tag;
  7         18  
  7         182  
19 7     7   2640 use WebService::Wikimapia::Photo;
  7         19  
  7         218  
20 7     7   2825 use WebService::Wikimapia::Comment;
  7         22  
  7         221  
21 7     7   2756 use WebService::Wikimapia::Polygon;
  7         18  
  7         199  
22 7     7   2583 use WebService::Wikimapia::Location;
  7         24  
  7         213  
23              
24 7     7   47 use Moo;
  7         14  
  7         24  
25 7     7   1844 use namespace::autoclean;
  7         13  
  7         29  
26              
27             has 'id' => (is => 'ro');
28             has 'name' => (is => 'ro');
29             has 'title' => (is => 'ro');
30             has 'language_id' => (is => 'ro');
31             has 'language_name' => (is => 'ro');
32             has 'language_iso' => (is => 'ro');
33             has 'url' => (is => 'ro');
34             has 'urlhtml' => (is => 'ro');
35             has 'lon' => (is => 'ro');
36             has 'lat' => (is => 'ro');
37             has 'distance' => (is => 'ro');
38             has 'tags' => (is => 'ro');
39             has 'polygon' => (is => 'ro');
40             has 'location' => (is => 'ro');
41             has 'photos' => (is => 'ro');
42             has 'comments' => (is => 'ro');
43             has 'availableLanguages' => (is => 'ro');
44             has 'contributedUsers' => (is => 'ro');
45             has 'nearestComments' => (is => 'ro');
46             has 'lastEditors' => (is => 'ro');
47             has 'similarPlaces' => (is => 'ro');
48             has 'nearestPlaces' => (is => 'ro');
49             has 'nearestHotels' => (is => 'ro');
50             has 'nearestCities' => (is => 'ro');
51              
52             sub BUILDARGS {
53 0     0 0   my ($class, $args) = @_;
54              
55 0 0         if (exists $args->{'nearestPlaces'}) {
56 0           my $places = [];
57 0           foreach my $id (keys %{$args->{'nearestPlaces'}}) {
  0            
58 0           push @$places, WebService::Wikimapia::Place->new($args->{'nearestPlaces'}->{$id});
59             }
60 0           $args->{'nearestPlaces'} = $places;
61             }
62              
63 0 0         if (exists $args->{'similarPlaces'}) {
64 0           my $places = [];
65 0           foreach my $id (keys %{$args->{'similarPlaces'}}) {
  0            
66 0           push @$places, WebService::Wikimapia::Place->new($args->{'similarPlaces'}->{$id});
67             }
68 0           $args->{'similarPlaces'} = $places;
69             }
70              
71 0 0         if (exists $args->{'nearestComments'}) {
72 0           my $comments = [];
73 0           foreach my $comment (@{$args->{'nearestComments'}}) {
  0            
74 0           push @$comments, WebService::Wikimapia::Comment->new($comment);
75             }
76 0           $args->{'nearestComments'} = $comments;
77             }
78              
79 0 0         if (exists $args->{'nearestHotels'}) {
80 0           my $hotels = [];
81 0           foreach my $id (keys %{$args->{'nearestHotels'}}) {
  0            
82 0           push @$hotels, WebService::Wikimapia::Hotel->new($args->{'nearestHotels'}->{$id});
83             }
84 0           $args->{'nearestHotels'} = $hotels;
85             }
86              
87 0 0         if (exists $args->{'nearestCities'}) {
88 0           my $cities = [];
89 0           foreach my $id (keys %{$args->{'nearestCities'}}) {
  0            
90 0           push @$cities, WebService::Wikimapia::City->new($args->{'nearestCities'}->{$id});
91             }
92 0           $args->{'nearestCities'} = $cities;
93             }
94              
95 0 0         if (exists $args->{'availableLanguages'}) {
96 0           my $languages = [];
97 0           foreach my $id (keys %{$args->{'availableLanguages'}}) {
  0            
98 0           push @$languages, WebService::Wikimapia::Language->new($args->{'availableLanguages'}->{$id});
99             }
100 0           $args->{'availableLanguages'} = $languages;
101             }
102              
103 0 0         if (exists $args->{'lastEditors'}) {
104 0           my $editors = [];
105 0           foreach my $id (keys %{$args->{'lastEditors'}}) {
  0            
106 0           push @$editors, WebService::Wikimapia::User->new($args->{'lastEditors'}->{$id});
107             }
108 0           $args->{'lastEditors'} = $editors;
109             }
110              
111 0 0         if (exists $args->{'contributedUsers'}) {
112 0           my $users = [];
113 0           foreach my $user (@{$args->{'contributedUsers'}}) {
  0            
114 0           push @$users, WebService::Wikimapia::User->new($user);
115             }
116 0           $args->{'contributedUsers'} = $users;
117             }
118              
119 0 0         if (exists $args->{'tags'}) {
120 0           my $tags = [];
121 0           foreach my $tag (@{$args->{'tags'}}) {
  0            
122 0           push @$tags, WebService::Wikimapia::Tag->new($tag);
123             }
124 0           $args->{'tags'} = $tags;
125             }
126              
127 0 0         if (exists $args->{'photos'}) {
128 0           my $photos = [];
129 0           foreach my $photo (@{$args->{'photos'}}) {
  0            
130 0           push @$photos, WebService::Wikimapia::Photo->new($photo);
131             }
132 0           $args->{'photos'} = $photos;
133             }
134              
135 0 0         if (exists $args->{'comments'}) {
136 0           my $comments = [];
137 0           foreach my $comment (@{$args->{'comments'}}) {
  0            
138 0           push @$comments, WebService::Wikimapia::Comment->new($comment);
139             }
140 0           $args->{'comments'} = $comments;
141             }
142              
143 0 0         if (exists $args->{'polygon'}) {
144 0           my $polygons = [];
145 0           foreach my $polygon (@{$args->{'polygon'}}) {
  0            
146 0           push @$polygons, WebService::Wikimapia::Polygon->new($polygon);
147             }
148 0           $args->{'polygon'} = $polygons;
149             }
150              
151 0 0         if (exists $args->{'location'}) {
152 0           $args->{'location'} = WebService::Wikimapia::Location->new($args->{'location'});
153             }
154              
155 0           return $args;
156             }
157              
158             =head1 METHODS
159              
160             =head2 id()
161              
162             =head2 name()
163              
164             =head2 title()
165              
166             =head2 language_id()
167              
168             =head2 language_name()
169              
170             =head2 language_iso()
171              
172             =head2 url()
173              
174             =head2 urlhtml()
175              
176             =head2 lon()
177              
178             =head2 lat()
179              
180             =head2 distance()
181              
182             =head2 tags()
183              
184             =head2 polygon()
185              
186             =head2 location()
187              
188             =head2 photos()
189              
190             =head2 comments()
191              
192             =head2 availableLanguages()
193              
194             =head2 contributedUsers()
195              
196             =head2 nearestComments()
197              
198             =head2 lastEditors()
199              
200             =head2 similarPlaces()
201              
202             =head2 nearestPlaces()
203              
204             =head2 nearestHotels()
205              
206             =head2 nearestCities()
207              
208             =head1 AUTHOR
209              
210             Mohammad S Anwar, C<< >>
211              
212             =head1 REPOSITORY
213              
214             L
215              
216             =head1 BUGS
217              
218             Please report any bugs or feature requests to C
219             rt.cpan.org>, or through the web interface at L.
220             I will be notified and then you'll automatically be notified of progress on your
221             bug as I make changes.
222              
223             =head1 SUPPORT
224              
225             You can find documentation for this module with the perldoc command.
226              
227             perldoc WebService::Wikimapia::Place
228              
229             You can also look for information at:
230              
231             =over 4
232              
233             =item * RT: CPAN's request tracker
234              
235             L
236              
237             =item * AnnoCPAN: Annotated CPAN documentation
238              
239             L
240              
241             =item * CPAN Ratings
242              
243             L
244              
245             =item * Search CPAN
246              
247             L
248              
249             =back
250              
251             =head1 LICENSE AND COPYRIGHT
252              
253             Copyright (C) 2011 - 2015 Mohammad S Anwar.
254              
255             This program is free software; you can redistribute it and/or modify it under
256             the terms of the the Artistic License (2.0). You may obtain a copy of the full
257             license at:
258              
259             L
260              
261             Any use, modification, and distribution of the Standard or Modified Versions is
262             governed by this Artistic License.By using, modifying or distributing the Package,
263             you accept this license. Do not use, modify, or distribute the Package, if you do
264             not accept this license.
265              
266             If your Modified Version has been derived from a Modified Version made by someone
267             other than you,you are nevertheless required to ensure that your Modified Version
268             complies with the requirements of this license.
269              
270             This license does not grant you the right to use any trademark, service mark,
271             tradename, or logo of the Copyright Holder.
272              
273             This license includes the non-exclusive, worldwide, free-of-charge patent license
274             to make, have made, use, offer to sell, sell, import and otherwise transfer the
275             Package with respect to any patent claims licensable by the Copyright Holder that
276             are necessarily infringed by the Package. If you institute patent litigation
277             (including a cross-claim or counterclaim) against any party alleging that the
278             Package constitutes direct or contributory patent infringement,then this Artistic
279             License to you shall terminate on the date that such litigation is filed.
280              
281             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND
282             CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
283             WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
284             NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS
285             REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT,
286             INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
287             OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
288              
289             =cut
290              
291             1; # End of WebService::Wikimapia::Place