Kolkatta.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 Kolkatta/Line/L1.pm »
1 package Map::Tube::Kolkatta;
2  
3 $Map::Tube::Kolkatta::VERSION = '0.22';
4 $Map::Tube::Kolkatta::AUTHORITY = 'cpan:MANWAR';
5  
6 =head1 NAME
7  
8 Map::Tube::Kolkatta - Interface to the Kolkatta Metro Map.
9  
10 =head1 VERSION
11  
12 Version 0.22
13  
14 =cut
15  
16 1 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use Data::Dumper;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶use File::ShareDir ':ALL';
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 has json => (is => 'ro', default => sub { return dist_file('Map-Tube-Kolkatta', 'kolkatta-map.json') });
24  
25 with 'Map::Tube';
26  
27 =head1 DESCRIPTION
28  
29 The Kolkata Metro was the first metro railway in India, opening for commercial
30 services from 1984. On 29 December 2010, Metro Railway, Kolkata became the 17th
31 zone of the Indian Railways, operated by the Ministry of Railways. There are 300
32 metro services daily carrying over 650,000 passengers making it the second
33 busiest metro system in India.
34  
35 It currently provides functionality to find the shortest route between the two
36 given stations. It covers the following lines of Kolkatta Metro:
37  
38 =over 2
39  
40 =item * L<Line 1|Map::Tube::Kolkatta::Line::L1>
41  
42 =item * L<Line 2|Map::Tube::Kolkatta::Line::L2>
43  
44 =item * L<Line 3|Map::Tube::Kolkatta::Line::L3>
45  
46 =item * L<Line 4|Map::Tube::Kolkatta::Line::L4>
47  
48 =item * L<Line 5|Map::Tube::Kolkatta::Line::L5>
49  
50 =item * L<Line 6|Map::Tube::Kolkatta::Line::L6>
51  
52 =back
53  
54 Source: L<wikipedia|https://en.wikipedia.org/wiki/Kolkata_Metro>.
55  
56 There is a very handy tool provided by L<Map::Tube::CLI> called C<map-tube> which
57 exposes the map (and all other maps) from command line. Please refer to its pod
58 document for more details. Support for C<Map::Tube::Kolkatta>, is available by
59 L<Map::Tube::CLI> v0.31 or above.
60  
61 =head1 CONSTRUCTOR
62  
63 The constructor DO NOT expects parameters.This setup the default node definitions.
64  
65 use strict; use warnings;
66 use Map::Tube::Kolkatta;
67  
68 my $metro = Map::Tube::Kolkatta->new;
69  
70 =head1 METHODS
71  
72 =head2 get_shortest_route($from, $to)
73  
74 It expects C<$from> and C<$to> station name, required param. It returns an object
75 of type L<Map::Tube::Route>. On error it throws exception of type L<Map::Tube::Exception>.
76  
77 use strict; use warnings;
78 use Map::Tube::Kolkatta;
79  
80 my $metro = Map::Tube::Kolkatta->new;
81 my $route = $metro->get_shortest_route('Esplanade', 'Central');
82  
83 print "Route: $route\n";
84  
85 =head2 as_image($line_name)
86  
87 It expects the plugin L<Map::Tube::Plugin::Graph> to be installed. Returns line
88 image as base64 encoded string if C<$line_name> passed in otherwise it returns
89 base64 encoded string of the entire map.
90  
91 use strict; use warnings;
92 use MIME::Base64;
93 use Map::Tube::Kolkatta;
94  
95 my $metro = Map::Tube::Kolkatta->new;
96 my $map = $metro->name;
97 open(my $IMAGE, ">", "$map.png")
98 or die "ERROR: Can't open [$map.png]: $!";
99 binmode($IMAGE);
100 print $IMAGE decode_base64($metro->as_image);
101 close($IMAGE);
102  
103 The L<Kolkatta Metro Map|https://raw.githubusercontent.com/manwar/Map-Tube-Kolkatta/master/maps/Kolkatta-Metro.png> as generated by plugin L<Map::Tube::Plugin::Graph>.
104  
105 =begin html
106  
107 <a href = "https://raw.githubusercontent.com/manwar/Map-Tube-Kolkatta/master/maps/Kolkatta-Metro.png">
108 <img src = "https://raw.githubusercontent.com/manwar/Map-Tube-Kolkatta/master/maps/Kolkatta-Metro.png"
109 alt = "Kolkatta Metro Map"
110 width = "500px"
111 height = "800px"/>
112 </a>
113  
114 =end html
115  
116 =head1 AUTHOR
117  
118 Mohammad S Anwar, C<< <mohammad.anwar at yahoo.com> >>
119  
120 =head1 REPOSITORY
121  
122 L<https://github.com/manwar/Map-Tube-Kolkatta>
123  
124 =head1 SEE ALSO
125  
126 L<Map::Tube::CLI>
127  
128 =head1 BUGS
129  
130 Please report any bugs/feature requests to C<bug-map-tube-kolkatta at rt.cpan.org>,
131 or through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Map-Tube-Kolkatta>.
132 I will be notified, and then you'll automatically be notified of progress on your
133 bug as I make changes.
134  
135 =head1 SUPPORT
136  
137 You can find documentation for this module with the perldoc command.
138  
139 perldoc Map::Tube::Kolkatta
140  
141 You can also look for information at:
142  
143 =over 4
144  
145 =item * RT: CPAN's request tracker (report bugs here)
146  
147 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Map-Tube-Kolkatta>
148  
149 =item * AnnoCPAN: Annotated CPAN documentation
150  
151 L<http://annocpan.org/dist/Map-Tube-Kolkatta>
152  
153 =item * CPAN Ratings
154  
155 L<http://cpanratings.perl.org/d/Map-Tube-Kolkatta>
156  
157 =item * Search CPAN
158  
159 L<http://search.cpan.org/dist/Map-Tube-Kolkatta/>
160  
161 =back
162  
163 =head1 LICENSE AND COPYRIGHT
164  
165 Copyright (C) 2017 Mohammad S Anwar.
166  
167 This program is free software; you can redistribute it and / or modify it under
168 the terms of the the Artistic License (2.0). You may obtain a copy of the full
169 license at:
170  
171 L<http://www.perlfoundation.org/artistic_license_2_0>
172  
173 Any use, modification, and distribution of the Standard or Modified Versions is
174 governed by this Artistic License.By using, modifying or distributing the Package,
175 you accept this license. Do not use, modify, or distribute the Package, if you do
176 not accept this license.
177  
178 If your Modified Version has been derived from a Modified Version made by someone
179 other than you,you are nevertheless required to ensure that your Modified Version
180 complies with the requirements of this license.
181  
182 This license does not grant you the right to use any trademark, service mark,
183 tradename, or logo of the Copyright Holder.
184  
185 This license includes the non-exclusive, worldwide, free-of-charge patent license
186 to make, have made, use, offer to sell, sell, import and otherwise transfer the
187 Package with respect to any patent claims licensable by the Copyright Holder that
188 are necessarily infringed by the Package. If you institute patent litigation
189 (including a cross-claim or counterclaim) against any party alleging that the
190 Package constitutes direct or contributory patent infringement,then this Artistic
191 License to you shall terminate on the date that such litigation is filed.
192  
193 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND
194 CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
195 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
196 NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS
197 REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT,
198 INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
199 OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
200  
201 =cut
202  
203 1; # End of Map::Tube::Kolkatta
↑ Summary Kolkatta/Line/L1.pm »