Delhi.pm

filter: Statementstmt 100% 14 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 19 / 19 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
↑ Summary Delhi/Line/Blue.pm »
1 package Map::Tube::Delhi;
2 $Map::Tube::Delhi::AUTHORITY = 'cpan:MANWAR';
3 $Map::Tube::Delhi::VERSION = '0.97';
4 =head1 NAME
5  
6 Map::Tube::Delhi - Interface to the Delhi Metro Map.
7  
8 =head1 VERSION
9  
10 version 0.97
11  
12 =cut
13  
14 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use File::ShareDir 1.114 ':ALL';
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
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<Red Line|Map::Tube::Delhi::Line::Red>
33  
34 =item * L<Blue Line|Map::Tube::Delhi::Line::Blue>
35  
36 =item * L<Green Line|Map::Tube::Delhi::Line::Green>
37  
38 =item * L<Yellow Line|Map::Tube::Delhi::Line::Yellow>
39  
40 =item * L<Violet Line|Map::Tube::Delhi::Line::Violet>
41  
42 =item * L<Orange Line|Map::Tube::Delhi::Line::Orange>
43  
44 =back
45  
46 For more information about Delhi Metro Map, get L<PDF|http://www.delhimetrorail.com/otherdocuments/route_map.pdf>.
47  
48 There is a very handy tool provided by L<Map::Tube::CLI> called C<map-tube> 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<Map::Tube::Route>. On error it throws exception of type L<Map::Tube::Exception>.
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<Map::Tube::Plugin::Graph> 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 or die "ERROR: Can't open [$map.png]: $!";
90 binmode($IMAGE);
91 print $IMAGE decode_base64($metro->as_image);
92 close($IMAGE);
93  
94 The L<Delhi Metro Map|https://raw.githubusercontent.com/manwar/Map-Tube-Delhi/master/maps/Delhi-Metro.png> as generated by plugin L<Map::Tube::Plugin::Graph>.
95  
96 =begin html
97  
98 <a href = "https://raw.githubusercontent.com/manwar/Map-Tube-Delhi/master/maps/Delhi-Metro.png">
99 <img src = "https://raw.githubusercontent.com/manwar/Map-Tube-Delhi/master/maps/Delhi-Metro.png"
100 alt = "Delhi Metro Map"
101 width = "500px"
102 height = "800px"/>
103 </a>
104  
105 =end html
106  
107 =head1 AUTHOR
108  
109 Mohammad S Anwar, C<< <mohammad.anwar at yahoo.com> >>
110  
111 =head1 REPOSITORY
112  
113 L<https://github.com/manwar/Map-Tube-Delhi>
114  
115 =head1 SEE ALSO
116  
117 L<Map::Tube::CLI>
118  
119 =head1 BUGS
120  
121 Please report any bugs/feature requests to C<bug-map-tube-delhi at rt.cpan.org>,
122 or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Map-Tube-Delhi>.
123 I will be notified, and then you'll automatically be notified of progress on your
124 bug as I make changes.
125  
126 =head1 SUPPORT
127  
128 You can find documentation for this module with the perldoc command.
129  
130 perldoc Map::Tube::Delhi
131  
132 You can also look for information at:
133  
134 =over 4
135  
136 =item * RT: CPAN's request tracker (report bugs here)
137  
138 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Map-Tube-Delhi>
139  
140 =item * AnnoCPAN: Annotated CPAN documentation
141  
142 L<http://annocpan.org/dist/Map-Tube-Delhi>
143  
144 =item * CPAN Ratings
145  
146 L<http://cpanratings.perl.org/d/Map-Tube-Delhi>
147  
148 =item * Search CPAN
149  
150 L<http://search.cpan.org/dist/Map-Tube-Delhi/>
151  
152 =back
153  
154 =head1 LICENSE AND COPYRIGHT
155  
156 Copyright (C) 2014 - 2019 Mohammad S Anwar.
157  
158 This program is free software; you can redistribute it and / or modify it under
159 the terms of the the Artistic License (2.0). You may obtain a copy of the full
160 license at:
161  
162 L<http://www.perlfoundation.org/artistic_license_2_0>
163  
164 Any use, modification, and distribution of the Standard or Modified Versions is
165 governed by this Artistic License.By using, modifying or distributing the Package,
166 you accept this license. Do not use, modify, or distribute the Package, if you do
167 not accept this license.
168  
169 If your Modified Version has been derived from a Modified Version made by someone
170 other than you,you are nevertheless required to ensure that your Modified Version
171 complies with the requirements of this license.
172  
173 This license does not grant you the right to use any trademark, service mark,
174 tradename, or logo of the Copyright Holder.
175  
176 This license includes the non-exclusive, worldwide, free-of-charge patent license
177 to make, have made, use, offer to sell, sell, import and otherwise transfer the
178 Package with respect to any patent claims licensable by the Copyright Holder that
179 are necessarily infringed by the Package. If you institute patent litigation
180 (including a cross-claim or counterclaim) against any party alleging that the
181 Package constitutes direct or contributory patent infringement,then this Artistic
182 License to you shall terminate on the date that such litigation is filed.
183  
184 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND
185 CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
186 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
187 NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS
188 REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT,
189 INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
190 OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
191  
192 =cut
193  
194 1; # End of Map::Tube::Delhi
↑ Summary Delhi/Line/Blue.pm »