blib/lib/Map/Tube/Chicago.pm

filter: Statementstmt 100% 20 / 20 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod n/a totaltotal 100% 27 / 27 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
↑ Summary
1 # -*- perl -*-
2 #
3 # Author: Gisbert W. Selke, TapirSoft Selke & Selke GbR.
4 #
5 # Copyright (C) 2025 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::Chicago;
12 1 ▶use 5.14.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use version 0.77 ( );
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
16
17 our $VERSION = version->declare('v0.2.3');
18
19 =encoding utf8
20
21 =head1 NAME
22
23 Map::Tube::Chicago - Interface to the Chicago L system map
24
25 =cut
26
27 1 ▶use File::Share ':all';
Subroutine BEGIN: called CC=1 SCAR=0.0
28 1 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 1 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
30
31 has xml => ( is => 'ro', default => sub { return dist_file('Map-Tube-Chicago', 'chicago-map.xml') } );
32
33 with 'Map::Tube';
34
35 =head1 SYNOPSIS
36
37 use Map::Tube::Chicago;
38 my $tube = Map::Tube::Chicago->new();
39
40 my $route = $tube->get_shortest_route( 'Fullerton', 'Library');
41
42 print "Route: $route\n";
43
44 =head1 DESCRIPTION
45
46 This module allows to find the shortest route between any two given tube or tram
47 stations in Chicago. All interesting methods are provided by the role L<Map::Tube>.
48 Since many stations in Chicago having the same name are in fact different stations,
49 this module disambiguates these names by attaching the parenthesized line name.
50 This also applies to stations of the same name where an interchange is possible
51 but requires a walk checking out from one station and checking in at another (of
52 the same name).
53
54 =head1 METHODS
55
56 =head2 CONSTRUCTOR
57
58 use Map::Tube::Chicago;
59 my $tube = Map::Tube::Chicago->new();
60
61 The only argument, C<xml>, is optional; if specified, it should be a code ref
62 to a function that returns either the path the XML map file, or a string
63 containing this XML content. The default is the path to F<chicago-map.xml>
64 that is a part of this distribution. For further information see L<Map::Tube>.
65
66 =head2 xml()
67
68 This read-only accessor returns whatever was specified as the XML source at
69 construction.
70
71 =head1 ERRORS
72
73 If something goes wrong, maybe because the map information file was corrupted,
74 the constructor will die.
75
76 =head1 AUTHOR
77
78 Gisbert W. Selke, TapirSoft Selke & Selke GbR.
79
80 =head1 COPYRIGHT AND LICENCE
81
82 The data for the XML file were taken from https://en.wikipedia.org/wiki/Chicago_%22L%22
83 and some pages linked from there.
84 The module itself is free software; you may redistribute and/or modify
85 it under the same terms as Perl itself.
86
87 =head1 SEE ALSO
88
89 L<Map::Tube>, L<Map::Tube::GraphViz>.
90
91 =cut
92
93 1;
↑ Summary