Barcelona.pm

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