| 1 | 1 | ▶ | use Map::Metro::Standard::Moops; |
|
Subroutine
BEGIN: called CC=1 SCAR=2.6
| |||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | |||
| 5 | our $VERSION = '0.0100'; # VERSION: | ||
| 6 | # PODNAME: Map::Metro::Cmd::Mroute | ||
| 7 | |||
| 8 | class Map::Metro::Cmd::Mroute extends Map::Metro::Cmd using Moose { | ||
| 9 | |||
| 10 | use MooseX::App::Command; | ||
| 11 | use HTTP::Tiny; | ||
| 12 | |||
| 13 | parameter cityname => ( | ||
| 14 | is => 'rw', | ||
| 15 | isa => Str, | ||
| 16 | documentation => 'The name of the city you want to search in', | ||
| 17 | required => 1, | ||
| 18 | ); | ||
| 19 | parameter origin => ( | ||
| 20 | is => 'rw', | ||
| 21 | isa => Str, | ||
| 22 | documentation => 'Start station', | ||
| 23 | required => 1, | ||
| 24 | ); | ||
| 25 | parameter destination => ( | ||
| 26 | is => 'rw', | ||
| 27 | isa => Str, | ||
| 28 | documentation => 'Final station', | ||
| 29 | required => 1, | ||
| 30 | ); | ||
| 31 | |||
| 32 | command_short_description 'Search in a map'; | ||
| 33 | |||
| 34 | method run { | ||
| 35 | |||
| 36 | my $url = sprintf 'http://localhost:3000/%s/%s/%s.txt', $self->cityname, $self->origin, $self->destination; | ||
| 37 | my $content = HTTP::Tiny->new->get($url)->{'content'}; | ||
| 38 | print $content; | ||
| 39 | } | ||
| 40 | } | ||
| 41 | |||
| 42 | 1; | ||
| 43 | |||
| 44 | __END__ | ||
| 45 | |||
| 46 | =pod | ||
| 47 | |||
| 48 | =encoding UTF-8 | ||
| 49 | |||
| 50 | =head1 NAME | ||
| 51 | |||
| 52 | Map::Metro::Cmd::Mroute | ||
| 53 | |||
| 54 | =head1 VERSION | ||
| 55 | |||
| 56 | Version 0.0100, released 2015-01-24. | ||
| 57 | |||
| 58 | =head1 DESCRIPTION | ||
| 59 | |||
| 60 | See L<route|Map::Metro::Cmd/"map-metro.pl route $city $from $to">. | ||
| 61 | |||
| 62 | =head1 HOMEPAGE | ||
| 63 | |||
| 64 | Please visit the project's homepage at L<https://metacpan.org/release/App-Map-Metro>. | ||
| 65 | |||
| 66 | =head1 AUTHOR | ||
| 67 | |||
| 68 | Erik Carlsson <info@code301.com> | ||
| 69 | |||
| 70 | =head1 COPYRIGHT AND LICENSE | ||
| 71 | |||
| 72 | This software is copyright (c) 2015 by Erik Carlsson <info@code301.com>. | ||
| 73 | |||
| 74 | This is free software; you can redistribute it and/or modify it under | ||
| 75 | the same terms as the Perl 5 programming language system itself. | ||
| 76 | |||
| 77 | =cut | ||