File Coverage

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