NAME
Map::Tube::Stockholm - Interface to the Stockholm tube and tram map
SYNOPSIS
use Map::Tube::Stockholm;
my $tube = Map::Tube::Stockholm->new();
my $route = $tube->get_shortest_route( 'Slussen', 'Solna strand');
print "Route: $route\n";
DESCRIPTION
This module allows to find the shortest route between any two given tube or tram stations in Stockholm. All interesting methods are provided by the role Map::Tube.
METHODS
CONSTRUCTOR
use Map::Tube::Stockholm;
my $tube = Map::Tube::Stockholm->new();
The only argument, xml
, is optional; if specified, it should be a code ref to a function that returns either the path the XML map file, or a string containing this XML content. The default is the path to stockholm-map.xml that is a part of this distribution. For further information see Map::Tube.
xml()
This read-only accessor returns whatever was specified as the XML source at construction.
NOTE CONCERNING DIAGRAM CREATION
This note concerns only those who want to produce network diagrams using Map::Tube::Plugin::Graph (also pertaining to Map::Tube::CLI) or Map::Tube::GraphViz.
There is a potential conflict between an advanced feature of the (excellent) GraphViz2 module and the Swedish station names, which may lead to an exception being thrown.
Users of Map::Tube::Plugin::Graph are encouraged to upgrade to at least version 0.48, which solves the issue cleanly. This also applies to indirect use of this module through Map::Tube::CLI and the corresponding command line programme.
Users of Map::Tube::GraphViz can prevent any issue cleanly by defining a function as follows:
sub mynode_id {
my ($self, $node) = @_;
return $node->id;
};
and supplying this as a callback function when creating the diagram:
my $g = Map::Tube::GraphViz->new( 'tube' => $tube,
callback_node_id => \&mynode_id, );
ERRORS
If something goes wrong, maybe because the map information file was corrupted, the constructor will die.
AUTHOR
Gisbert W. Selke, TapirSoft Selke & Selke GbR.
COPYRIGHT AND LICENCE
The data for the XML file were taken from https://tunnelbanakarta.se/ The module itself is free software; you may redistribute and/or modify it under the same terms as Perl itself.