NYC.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 NYC/Line/BMTCanarsie.pm »
1 package Map::Tube::NYC;
2  
3 $Map::Tube::NYC::VERSION = '0.53';
4 $Map::Tube::NYC::AUTHORITY = 'cpan:MANWAR';
5  
6 =head1 NAME
7  
8 Map::Tube::NYC - Interface to the NYC Subway Map.
9  
10 =head1 VERSION
11  
12 Version 0.53
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::Share ':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 xml => (is => 'ro', default => sub { return dist_file('Map-Tube-NYC', 'nyc-map.xml') });
24  
25 with 'Map::Tube';
26  
27 =encoding utf8
28  
29 =head1 DESCRIPTION
30  
31 It currently provides functionality to find the shortest route between the two
32 given nodes. It covers the following subway lines just yet:
33  
34 =over 2
35  
36 =item * L<IND Sixth Avenue Line|Map::Tube::NYC::Line::INDSixthAvenue>
37  
38 =item * L<IND Eighth Avenue Line|Map::Tube::NYC::Line::INDEighthAvenue>
39  
40 =item * L<IND Crosstown Line|Map::Tube::NYC::Line::INDCrosstown>
41  
42 =item * L<IRT Flushing Line|Map::Tube::NYC::Line::IRTFlushing>
43  
44 =item * L<BMT Canarsie Line|Map::Tube::NYC::Line::BMTCanarsie>
45  
46 =item * L<BMT Nassau Street Line|Map::Tube::NYC::Line::BMTNassauStreet>
47  
48 =item * L<IRT Lexington Avenue Line|Map::Tube::NYC::Line::IRTLexingtonAvenue>
49  
50 =back
51  
52 =head1 TODO (Subway Lines)
53  
54 =over 2
55  
56 =item * BMT Broadway Line
57  
58 =item * IRT Broadway Line
59  
60 =back
61  
62 =head1 CONSTRUCTOR
63  
64 The constructor DO NOT expects parameters.This setup the default node definitions.
65  
66 use strict; use warnings;
67 use Map::Tube::NYC;
68  
69 my $subway = Map::Tube::NYC->new;
70  
71 =head1 METHODS
72  
73 =head2 get_shortest_route($from, $to)
74  
75 It expects C<$from> and C<$to> station name, required param. It returns an object
76 of type L<Map::Tube::Route>. On error it throws exception of type L<Map::Tube::Exception>.
77  
78 use strict; use warnings;
79 use Map::Tube::NYC;
80  
81 my $subway = Map::Tube::NYC->new;
82 my $route = $subway->get_shortest_route('Canal Street', 'High Street');
83  
84 print "Route: $route\n";;
85  
86 =head2 as_image($line_name)
87  
88 It expects the plugin L<Map::Tube::Plugin::Graph> to be installed. Returns line
89 image as base64 encoded string if C<$line_name> passed in otherwise it returns
90 base64 encoded string of the entire map.
91  
92 use strict; use warnings;
93 use MIME::Base64;
94 use Map::Tube::NYC;
95  
96 my $subway = Map::Tube::NYC->new;
97 my $map = $subway->name;
98 open(my $IMAGE, ">$map.png");
99 binmode($IMAGE);
100 print $IMAGE decode_base64($subway->as_image);
101 close($IMAGE);
102  
103 The L<NYC Subway Map|https://raw.githubusercontent.com/manwar/Map-Tube-NYC/master/maps/NYC-Subway.png>
104 map as generated by plugin L<Map::Tube::Plugin::Graph>.
105  
106 =begin html
107  
108 <a href = "https://raw.githubusercontent.com/manwar/Map-Tube-NYC/master/maps/NYC-Subway.png">
109 <img src = "https://raw.githubusercontent.com/manwar/Map-Tube-NYC/master/maps/NYC-Subway.png"
110 alt = "NYC Subway Map"
111 width = "500px"
112 height = "700px"/>
113 </a>
114  
115 =end html
116  
117 =head1 AUTHOR
118  
119 Mohammad S Anwar, C<< <mohammad.anwar at yahoo.com> >>
120  
121 =head1 REPOSITORY
122  
123 L<https://github.com/manwar/Map-Tube-NYC>
124  
125 =head1 BUGS
126  
127 Please report any bugs/feature requests to C<bug-map-tube-nyc at rt.cpan.org>, or
128 through the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Map-Tube-NYC>.
129 I will be notified, and then you'll automatically be notified of progress on your
130 bug as I make changes.
131  
132 =head1 SUPPORT
133  
134 You can find documentation for this module with the perldoc command.
135  
136 perldoc Map::Tube::NYC
137  
138 You can also look for information at:
139  
140 =over 4
141  
142 =item * RT: CPAN's request tracker (report bugs here)
143  
144 L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Map-Tube-NYC>
145  
146 =item * AnnoCPAN: Annotated CPAN documentation
147  
148 L<http://annocpan.org/dist/Map-Tube-NYC>
149  
150 =item * CPAN Ratings
151  
152 L<http://cpanratings.perl.org/d/Map-Tube-NYC>
153  
154 =item * Search CPAN
155  
156 L<http://search.cpan.org/dist/Map-Tube-NYC/>
157  
158 =back
159  
160 =head1 LICENSE AND COPYRIGHT
161  
162 Copyright (C) 2014 - 2016 Mohammad S Anwar.
163  
164 This program is free software; you can redistribute it and/or modify it under
165 the terms of the the Artistic License (2.0). You may obtain a copy of the full
166 license at:
167  
168 L<http://www.perlfoundation.org/artistic_license_2_0>
169  
170 Any use, modification, and distribution of the Standard or Modified Versions is
171 governed by this Artistic License.By using, modifying or distributing the Package,
172 you accept this license. Do not use, modify, or distribute the Package, if you do
173 not accept this license.
174  
175 If your Modified Version has been derived from a Modified Version made by someone
176 other than you,you are nevertheless required to ensure that your Modified Version
177 complies with the requirements of this license.
178  
179 This license does not grant you the right to use any trademark, service mark,
180 tradename, or logo of the Copyright Holder.
181  
182 This license includes the non-exclusive, worldwide, free-of-charge patent license
183 to make, have made, use, offer to sell, sell, import and otherwise transfer the
184 Package with respect to any patent claims licensable by the Copyright Holder that
185 are necessarily infringed by the Package. If you institute patent litigation
186 (including a cross-claim or counterclaim) against any party alleging that the
187 Package constitutes direct or contributory patent infringement,then this Artistic
188 License to you shall terminate on the date that such litigation is filed.
189  
190 Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT HOLDER AND
191 CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES. THE IMPLIED
192 WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR
193 NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT PERMITTED BY YOUR LOCAL LAW. UNLESS
194 REQUIRED BY LAW, NO COPYRIGHT HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT,
195 INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
196 OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
197  
198 =cut
199  
200 1; # End of Map::Tube::NYC
↑ Summary NYC/Line/BMTCanarsie.pm »