line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# -*- perl -*-
|
2
|
|
|
|
|
|
|
#
|
3
|
|
|
|
|
|
|
# Author: Gisbert W. Selke, TapirSoft Selke & Selke GbR.
|
4
|
|
|
|
|
|
|
#
|
5
|
|
|
|
|
|
|
# Copyright (C) 2015 Gisbert W. Selke. All rights reserved.
|
6
|
|
|
|
|
|
|
# This package is free software; you can redistribute it and/or
|
7
|
|
|
|
|
|
|
# modify it under the same terms as Perl itself.
|
8
|
|
|
|
|
|
|
#
|
9
|
|
|
|
|
|
|
# Mail: gws@cpan.org
|
10
|
|
|
|
|
|
|
#
|
11
|
|
|
|
|
|
|
package Map::Tube::Glasgow;
|
12
|
1
|
|
|
1
|
|
374519
|
use strict;
|
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
33
|
|
13
|
1
|
|
|
1
|
|
4
|
use warnings;
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
43
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $VERSION = '0.07';
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=encoding utf8
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 NAME
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
Map::Tube::Glasgow - Interface to the Glasgow tube map
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=cut
|
24
|
|
|
|
|
|
|
|
25
|
1
|
|
|
1
|
|
620
|
use File::Share ':all';
|
|
1
|
|
|
|
|
9285
|
|
|
1
|
|
|
|
|
160
|
|
26
|
1
|
|
|
1
|
|
49908
|
use Moo;
|
|
1
|
|
|
|
|
16718
|
|
|
1
|
|
|
|
|
5
|
|
27
|
1
|
|
|
1
|
|
1888
|
use namespace::clean;
|
|
1
|
|
|
|
|
22492
|
|
|
1
|
|
|
|
|
10
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
has xml => ( is => 'ro', default => sub { return dist_file('Map-Tube-Glasgow', 'glasgow-map.xml') } );
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
with 'Map::Tube';
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 SYNOPSIS
|
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
use Map::Tube::Glasgow;
|
36
|
|
|
|
|
|
|
my $tube = Map::Tube::Glasgow->new();
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
my $route = $tube->get_shortest_route('Cowcaddens', 'Bridge Street');
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
print "Route: $route\n";
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 DESCRIPTION
|
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
This module allows to find the shortest route between any two given tube
|
45
|
|
|
|
|
|
|
stations in Glasgow. All interesting methods are provided by the role L.
|
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 METHODS
|
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head2 CONSTRUCTOR
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
use Map::Tube::Glasgow;
|
52
|
|
|
|
|
|
|
my $tube = Map::Tube::Glasgow->new();
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
The only argument, C, is optional; if specified, it should be a code ref
|
55
|
|
|
|
|
|
|
to a function that returns either the path the XML map file, or a string
|
56
|
|
|
|
|
|
|
containing this XML content. The default is the path to F
|
57
|
|
|
|
|
|
|
that is a part of this distribution. For further information see L.
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head2 xml()
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
This read-only accessor returns whatever was specified as the XML source at
|
62
|
|
|
|
|
|
|
construction.
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 ERRORS
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
If something goes wrong, maybe because the map information file was corrupted,
|
67
|
|
|
|
|
|
|
the constructor will die.
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 AUTHOR
|
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Gisbert W. Selke, TapirSoft Selke & Selke GbR.
|
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENCE
|
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
The data for the XML file were taken from an image in the English-language
|
76
|
|
|
|
|
|
|
Wikipedia in the entry "Glasgow Subway". It is CC BY-SA 2.0 David Arthur, 2006.
|
77
|
|
|
|
|
|
|
The module itself is free software; you may redistribute and/or modify
|
78
|
|
|
|
|
|
|
it under the same terms as Perl itself.
|
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 SEE ALSO
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
L, L.
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1;
|