line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Map::Tube::Kolkatta; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
$Map::Tube::Kolkatta::VERSION = '0.06'; |
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.06 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=cut |
15
|
|
|
|
|
|
|
|
16
|
1
|
|
|
1
|
|
65806
|
use 5.006; |
|
1
|
|
|
|
|
5
|
|
17
|
1
|
|
|
1
|
|
395
|
use Data::Dumper; |
|
1
|
|
|
|
|
5110
|
|
|
1
|
|
|
|
|
91
|
|
18
|
1
|
|
|
1
|
|
227
|
use File::Share ':all'; |
|
1
|
|
|
|
|
5326
|
|
|
1
|
|
|
|
|
151
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
381
|
use Moo; |
|
1
|
|
|
|
|
7839
|
|
|
1
|
|
|
|
|
6
|
|
21
|
1
|
|
|
1
|
|
1269
|
use namespace::clean; |
|
1
|
|
|
|
|
8307
|
|
|
1
|
|
|
|
|
9
|
|
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 |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=item * L |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=item * L |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=item * L |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
=item * L |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=item * L |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=back |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Source: L. |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
There is a very handy tool provided by L called C 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, is available by |
59
|
|
|
|
|
|
|
L 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. On error it throws exception of type L. |
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 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
|
|
|
|
|
|
|
binmode($IMAGE); |
99
|
|
|
|
|
|
|
print $IMAGE decode_base64($metro->as_image); |
100
|
|
|
|
|
|
|
close($IMAGE); |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
The L as generated by plugin L. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=begin html |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
alt = "Kolkatta Metro Map" |
109
|
|
|
|
|
|
|
width = "500px" |
110
|
|
|
|
|
|
|
height = "800px"/> |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=end html |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=head1 AUTHOR |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
Mohammad S Anwar, C<< >> |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
=head1 REPOSITORY |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
L |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
=head1 SEE ALSO |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
L |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 BUGS |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Please report any bugs/feature requests to C, |
130
|
|
|
|
|
|
|
or through the web interface at L. |
131
|
|
|
|
|
|
|
I will be notified, and then you'll automatically be notified of progress on your |
132
|
|
|
|
|
|
|
bug as I make changes. |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 SUPPORT |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
You can find documentation for this module with the perldoc command. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
perldoc Map::Tube::Kolkatta |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
You can also look for information at: |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=over 4 |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item * RT: CPAN's request tracker (report bugs here) |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
L |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item * AnnoCPAN: Annotated CPAN documentation |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
L |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item * CPAN Ratings |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
L |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=item * Search CPAN |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
L |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=back |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
Copyright (C) 2017 Mohammad S Anwar. |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
This program is free software; you can redistribute it and / or modify it under |
167
|
|
|
|
|
|
|
the terms of the the Artistic License (2.0). You may obtain a copy of the full |
168
|
|
|
|
|
|
|
license at: |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
L |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Any use, modification, and distribution of the Standard or Modified Versions is |
173
|
|
|
|
|
|
|
governed by this Artistic License.By using, modifying or distributing the Package, |
174
|
|
|
|
|
|
|
you accept this license. Do not use, modify, or distribute the Package, if you do |
175
|
|
|
|
|
|
|
not accept this license. |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
If your Modified Version has been derived from a Modified Version made by someone |
178
|
|
|
|
|
|
|
other than you,you are nevertheless required to ensure that your Modified Version |
179
|
|
|
|
|
|
|
complies with the requirements of this license. |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
This license does not grant you the right to use any trademark, service mark, |
182
|
|
|
|
|
|
|
tradename, or logo of the Copyright Holder. |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
This license includes the non-exclusive, worldwide, free-of-charge patent license |
185
|
|
|
|
|
|
|
to make, have made, use, offer to sell, sell, import and otherwise transfer the |
186
|
|
|
|
|
|
|
Package with respect to any patent claims licensable by the Copyright Holder that |
187
|
|
|
|
|
|
|
are necessarily infringed by the Package. If you institute patent litigation |
188
|
|
|
|
|
|
|
(including a cross-claim or counterclaim) against any party alleging that the |
189
|
|
|
|
|
|
|
Package constitutes direct or contributory patent infringement,then this Artistic |
190
|
|
|
|
|
|
|
License to you shall terminate on the date that such litigation is filed. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND |
193
|
|
|
|
|
|
|
CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED |
194
|
|
|
|
|
|
|
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR |
195
|
|
|
|
|
|
|
NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS |
196
|
|
|
|
|
|
|
REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, |
197
|
|
|
|
|
|
|
INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE |
198
|
|
|
|
|
|
|
OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
199
|
|
|
|
|
|
|
|
200
|
|
|
|
|
|
|
=cut |
201
|
|
|
|
|
|
|
|
202
|
|
|
|
|
|
|
1; # End of Map::Tube::Kolkatta |