NAME
    Map::Tube::Text::Shortest - Shortest route information via Map::Tube
    object.

SYNOPSIS
     use Map::Tube::Test::Shortest;

     my $obj = Map::Tube::Text::Shortest->new(%params);
     print $obj->print($from, $to);

METHODS
  "new"
     my $obj = Map::Tube::Text::Shortest->new(%params);

    Constructor.

    *       "tube"

            Map::Tube object.

            Parameter is required.

            Default value is undef.

    Returns instance of object.

  "print"
     print $obj->print($from, $to);

    Print shortest route table.

    Returns string with table.

ERRORS
     new():
             Parameter 'tube' is required.
             Parameter 'tube' must be 'Map::Tube' object.

EXAMPLE
     use strict;
     use warnings;

     use English;
     use Encode qw(decode_utf8 encode_utf8);
     use Error::Pure qw(err);
     use Map::Tube::Text::Shortest;

     # Arguments.
     if (@ARGV < 3) {
             print STDERR "Usage: $0 metro from to\n";
             exit 1;
     }
     my $metro = $ARGV[0];
     my $from = decode_utf8($ARGV[1]);
     my $to = decode_utf8($ARGV[2]);

     # Load metro object.
     my $class = 'Map::Tube::'.$metro;
     eval "require $class;";
     if ($EVAL_ERROR) {
             err "Cannot load '$class' class.",
                     'Error', $EVAL_ERROR;
     }

     # Metro object. 
     my $tube = eval "$class->new";
     if ($EVAL_ERROR) {
             err "Cannot create object for '$class' class.",
                     'Error', $EVAL_ERROR;
     }

     # Table object.
     my $table = Map::Tube::Text::Shortest->new(
             'tube' => $tube,
     );
 
     # Print out.
     print encode_utf8(scalar $table->print($from, $to))."\n";

     # Output without arguments like:
     # Usage: /tmp/O0s_2qtAuB metro from to

     # Output with 'Budapest', 'Fővám tér', 'Opera' arguments like:
     # 
     # From Fővám tér to Opera
     # =======================
     # 
     # -- Route 1 (cost ?) ----------
     # [   M4 ] Fővám tér
     # [   M3 ] Kálvin tér
     # [ * M4 ] Kálvin tér
     # [   M3 ] Ferenciek tere
     # [   M1 ] Deák Ferenc tér
     # [ * M2 ] Deák Ferenc tér
     # [   M3 ] Deák Ferenc tér
     # [   M1 ] Bajcsy-Zsilinszky út
     # [   M1 ] Opera
     # 
     # M1  Linia M1
     # M3  Linia M3
     # M2  Linia M2
     # M4  Linia M4
     # 
     # *: Transfer to other line
     # +: Transfer to other station
     #

DEPENDENCIES
    Class::Utils, Error::Pure, List::Util, Readonly, Scalar::Util.

SEE ALSO
    Task::Map::Tube
        Install the Map::Tube modules.

    Task::Map::Tube::Metro
        Install the Map::Tube concrete metro modules.

REPOSITORY
    <https://github.com/michal-josef-spacek/Map-Tube-Text-Shortest>

AUTHOR
    Michal Josef Špaček <mailto:skim@cpan.org>

    <http://skim.cz>

LICENSE AND COPYRIGHT
    © 2014-2023 Michal Josef Špaček

    Artistic License

    BSD 2-Clause License

VERSION
    0.02

