File Coverage

blib/lib/Map/Tube/Delhi.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 19 19 100.0


line stmt bran cond sub pod time code
1             package Map::Tube::Delhi;
2             $Map::Tube::Delhi::AUTHORITY = 'cpan:MANWAR';
3             $Map::Tube::Delhi::VERSION = '0.61';
4             =head1 NAME
5              
6             Map::Tube::Delhi - Interface to the Delhi Metro Map.
7              
8             =head1 VERSION
9              
10             version 0.61
11              
12             =cut
13              
14 1     1   44760 use 5.006;
  1         2  
15 1     1   349 use Data::Dumper;
  1         4745  
  1         51  
16 1     1   210 use File::Share ':all';
  1         5125  
  1         127  
17              
18 1     1   314 use Moo;
  1         7417  
  1         4  
19 1     1   1227 use namespace::clean;
  1         7518  
  1         5  
20              
21             has json => (is => 'ro', default => sub { return dist_file('Map-Tube-Delhi', 'delhi-map.json') });
22              
23             with 'Map::Tube';
24              
25             =head1 DESCRIPTION
26              
27             It currently provides functionality to find the shortest route between the two
28             given stations. It covers the following lines of Delhi Metro:
29              
30             =over 2
31              
32             =item * L
33              
34             =item * L
35              
36             =item * L
37              
38             =item * L
39              
40             =item * L
41              
42             =item * L
43              
44             =back
45              
46             For more information about Delhi Metro Map, get L.
47              
48             There is a very handy tool provided by L called C which
49             exposes the map (and all other maps) from command line. Please refer to its pod
50             document for more details.
51              
52             =head1 CONSTRUCTOR
53              
54             The constructor DO NOT expects parameters.This setup the default node definitions.
55              
56             use strict; use warnings;
57             use Map::Tube::Delhi;
58              
59             my $metro = Map::Tube::Delhi->new;
60              
61             =head1 METHODS
62              
63             =head2 get_shortest_route($from, $to)
64              
65             It expects C<$from> and C<$to> station name, required param. It returns an object
66             of type L. On error it throws exception of type L.
67              
68             use strict; use warnings;
69             use Map::Tube::Delhi;
70              
71             my $metro = Map::Tube::Delhi->new;
72             my $route = $metro->get_shortest_route('Pratap Nagar', 'Shivaji Park');
73              
74             print "Route: $route\n";
75              
76             =head2 as_image($line_name)
77              
78             It expects the plugin L to be installed. Returns line
79             image as base64 encoded string if C<$line_name> passed in otherwise it returns
80             base64 encoded string of the entire map.
81              
82             use strict; use warnings;
83             use MIME::Base64;
84             use Map::Tube::Delhi;
85              
86             my $metro = Map::Tube::Delhi->new;
87             my $map = $metro->name;
88             open(my $IMAGE, ">$map.png");
89             binmode($IMAGE);
90             print $IMAGE decode_base64($metro->as_image);
91             close($IMAGE);
92              
93             The L as generated by plugin L.
94              
95             =begin html
96              
97            
98            
99             alt = "Delhi Metro Map"
100             width = "500px"
101             height = "800px"/>
102            
103              
104             =end html
105              
106             =head1 AUTHOR
107              
108             Mohammad S Anwar, C<< >>
109              
110             =head1 REPOSITORY
111              
112             L
113              
114             =head1 SEE ALSO
115              
116             L
117              
118             =head1 BUGS
119              
120             Please report any bugs/feature requests to C,
121             or through the web interface at L.
122             I will be notified, and then you'll automatically be notified of progress on your
123             bug as I make changes.
124              
125             =head1 SUPPORT
126              
127             You can find documentation for this module with the perldoc command.
128              
129             perldoc Map::Tube::Delhi
130              
131             You can also look for information at:
132              
133             =over 4
134              
135             =item * RT: CPAN's request tracker (report bugs here)
136              
137             L
138              
139             =item * AnnoCPAN: Annotated CPAN documentation
140              
141             L
142              
143             =item * CPAN Ratings
144              
145             L
146              
147             =item * Search CPAN
148              
149             L
150              
151             =back
152              
153             =head1 LICENSE AND COPYRIGHT
154              
155             Copyright (C) 2014 - 2016 Mohammad S Anwar.
156              
157             This program is free software; you can redistribute it and / or modify it under
158             the terms of the the Artistic License (2.0). You may obtain a copy of the full
159             license at:
160              
161             L
162              
163             Any use, modification, and distribution of the Standard or Modified Versions is
164             governed by this Artistic License.By using, modifying or distributing the Package,
165             you accept this license. Do not use, modify, or distribute the Package, if you do
166             not accept this license.
167              
168             If your Modified Version has been derived from a Modified Version made by someone
169             other than you,you are nevertheless required to ensure that your Modified Version
170             complies with the requirements of this license.
171              
172             This license does not grant you the right to use any trademark, service mark,
173             tradename, or logo of the Copyright Holder.
174              
175             This license includes the non-exclusive, worldwide, free-of-charge patent license
176             to make, have made, use, offer to sell, sell, import and otherwise transfer the
177             Package with respect to any patent claims licensable by the Copyright Holder that
178             are necessarily infringed by the Package. If you institute patent litigation
179             (including a cross-claim or counterclaim) against any party alleging that the
180             Package constitutes direct or contributory patent infringement,then this Artistic
181             License to you shall terminate on the date that such litigation is filed.
182              
183             Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND
184             CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
185             WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
186             NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS
187             REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT,
188             INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
189             OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
190              
191             =cut
192              
193             1; # End of Map::Tube::Delhi