NAME

Map::Tube::London - Interface to the London Tube Map.

VERSION

Version v2.1.0

DESCRIPTION

It currently provides functionality to find the shortest route between the two given nodes. It covers the following tube lines:

CONSTRUCTOR

The constructor DO NOT expects parameters.This setup the default node definitions.

use strict; use warnings;
use Map::Tube::London;

my $tube = Map::Tube::London->new;

METHODS

get_shortest_route($from, $to)

It expects $from and $to station name, required param. It returns an object of type Map::Tube::Route. On error it throws exception of type Map::Tube::Exception.

use strict; use warnings;
use Map::Tube::London;

my $tube  = Map::Tube::London->new;
my $route = $tube->get_shortest_route('Baker Street', 'Farringdon');

print "Route: $route\n";;

as_image($line_name)

It expects the plugin Map::Tube::Plugin::Graph to be installed. Returns line image as base64 encoded string if $line_name passed in otherwise it returns base64 encoded string of the entire map.

use strict; use warnings;
use MIME::Base64;
use Map::Tube::London;

my $tube = Map::Tube::London->new;
my $map  = $tube->name;
open(my $IMAGE, ">", "$map.png");
   or die "ERROR: Can't open [$map.png]: $!";
binmode($IMAGE);
print $IMAGE decode_base64($tube->as_image);
close($IMAGE);

The London Tube Map as generated by plugin Map::Tube::Plugin::Graph.

London Tube Map

AUTHOR

Mohammad Sajid Anwar, <mohammad.anwar at yahoo.com>

REPOSITORY

https://github.com/manwar/Map-Tube-London

CONTRIBUTORS

  • Ed J

BUGS

Please report any bugs or feature requests through the web interface at https://github.com/manwar/Map-Tube-London/issues. I will be notified and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

perldoc Map::Tube::London

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright (C) 2014 - 2026 Mohammad Sajid Anwar.

This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License (2.0).