line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- perl -*- |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
# Author: Slaven Rezic |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Copyright (C) 2014,2015,2016 Slaven Rezic. All rights reserved. |
7
|
|
|
|
|
|
|
# This package is free software; you can redistribute it and/or |
8
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself. |
9
|
|
|
|
|
|
|
# |
10
|
|
|
|
|
|
|
# Mail: srezic@cpan.org |
11
|
|
|
|
|
|
|
# |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
package Map::Tube::Berlin; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
$VERSION = '0.13'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Map::Tube::Berlin - interface to the Berlin S- and U-Bahn map |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
3
|
|
|
3
|
|
42233
|
use File::Share ':all'; |
|
3
|
|
|
|
|
14980
|
|
|
3
|
|
|
|
|
424
|
|
24
|
|
|
|
|
|
|
|
25
|
3
|
|
|
3
|
|
1410
|
use Moo; |
|
3
|
|
|
|
|
27585
|
|
|
3
|
|
|
|
|
17
|
|
26
|
3
|
|
|
3
|
|
5482
|
use namespace::clean; |
|
3
|
|
|
|
|
24050
|
|
|
3
|
|
|
|
|
10
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has xml => (is => 'ro', default => sub { return dist_file('Map-Tube-Berlin', 'berlin-map.xml') }); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
with 'Map::Tube'; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 DESCRIPTION |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
It currently provides functionality to find the shortest route between |
35
|
|
|
|
|
|
|
the two given stations. The map contains both U-Bahn and S-Bahn stations. |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head1 CONSTRUCTOR |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
use Map::Tube::Berlin; |
40
|
|
|
|
|
|
|
my $tube = Map::Tube::Berlin->new; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 METHODS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 get_shortest_route(I, I) |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
This method expects two parameters I and I station name. |
47
|
|
|
|
|
|
|
Station names are case insensitive. The station sequence from I |
48
|
|
|
|
|
|
|
to I is returned. |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
use Map::Tube::Berlin; |
51
|
|
|
|
|
|
|
my $tube = Map::Tube::Berlin->new; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
my $route = $tube->get_shortest_route('Zoologischer Garten', 'Alexanderplatz'); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
print "Route: $route\n"; |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 NOTES |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
The XML file was generated using data from the L
|
60
|
|
|
|
|
|
|
project|https://github.com/eserte/bbbike>. A Makefile rule |
61
|
|
|
|
|
|
|
C for regenerating the XML file exists (assuming that |
62
|
|
|
|
|
|
|
BBBike was cloned/extracted into F<$HOME/src/bbbike>. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 AUTHOR |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
Slaven Rezic |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SEE ALSO |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
L. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |