The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Travel::UK::London::Tube::Node - Defines the node for Travel::UK::London::Tube.

VERSION

Version 0.03

DESCRIPTION

      B --------  C
     /  \       /  \
    /    \     /    \
   /      \   /      \
  A ------  G ------- D
   \      /   \      /
    \    /     \    /
     \  /       \  /
      F -------- E
     /
    /
   /
  H
   \
    \
     \
      I

  which can be defined as below:

  { 'A' => ['B','F','G'],
    'B' => ['A','C','G'],
    'C' => ['B','D','G'],
    'D' => ['C','E','G'],
    'E' => ['D','F','G'],
    'F' => ['A','E','G','H'],
    'G' => ['A','B','C','D','E','F'],
    'H' => ['F','I'],
    'I' => ['H']
  }

METHODS

load_node_mappings()

This is the core method of the module, where we actually define the relationship among the diffrerent nodes. I have taken extra care to depict the relationship. However I would be more than happy to receieve any suggestion to improve the logic. Please note "Transport for London" is the owner of the data used here.

  use strict; use warnings;
  use Map::Tube::Node;

  # Loads up the default node mapping definitions.
  my $mappings = Map::Tube::Node::load_node_mappings();

load_nodes()

This loads all the nodes defined. It covers Bakerloo,Central,Circle,District, DLR, Hammersmith & City, Jubilee, Metropolitan, Northern, Overground, Piccadilly, Victoria and Waterloo & City.

  use strict; use warnings;
  use Travel::UK::London::Tube::Node;

  # Loads all the node definitions.
  my $nodes = Travel::UK::London::Tube::Node::load_nodes();

load_node_lines()

This loads all the tube lines with their node code.

  use strict; use warnings;
  use Travel::UK::London::Tube::Node;

  # Loads all the node codes with the default tube lines information.
  my $lines = Travel::UK::London::Tube::Node::load_node_lines();

upcase_node_names()

This loads all the nodes with name in uppercase.This is to allow case-insensitive name lookup. User can also provide the node list otherwise it will pick the default list.

  use strict; use warnings;
  use Travel::UK::London::Tube::Node;

  # Returns a new list of element with names in upper case.
  my $upcase = Travel::UK::London::Tube::Node::upcase_node_names();

AUTHOR

Mohammad S Anwar, <mohammad.anwar@yahoo.com>

BUGS

Please report any bugs or feature requests to bug-travel-uk-london-tube@rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Travel-London-UK-Tube. 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 Travel::UK::London::Tube::Node

You can also look for information at:

LICENSE AND COPYRIGHT

Copyright 2011 Mohammad S Anwar.

This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.

See http://dev.perl.org/licenses/ for more information.

DISCLAIMER

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.