| 1 | 1 | ▶ | use 5.10.0; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | 1 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 1 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | package Map::Metro::Cmd::Route; | ||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | # ABSTRACT: Search in a map | ||||||||||||||||||||
| 8 | 1 | our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY | |||||||||||||||||||
| 9 | 1 | our $VERSION = '0.2405'; | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 1 | ▶ | use Map::Metro::Elk; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 1 | ▶ | use MooseX::App::Command; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | 1 | extends 'Map::Metro::Cmd'; | |||||||||||||||||||
| 14 | 1 | ▶ | use Types::Standard qw/Str/; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 15 | 1 | ▶ | use Try::Tiny; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 16 | 1 | ▶ | use Safe::Isa qw/$_call_if_object/; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 1 | parameter cityname => ( | |||||||||||||||||||
| 19 | is => 'rw', | ||||||||||||||||||||
| 20 | isa => Str, | ||||||||||||||||||||
| 21 | documentation => 'The name of the city you want to search in', | ||||||||||||||||||||
| 22 | required => 1, | ||||||||||||||||||||
| 23 | ); | ||||||||||||||||||||
| 24 | 1 | parameter origin => ( | |||||||||||||||||||
| 25 | is => 'rw', | ||||||||||||||||||||
| 26 | isa => Str, | ||||||||||||||||||||
| 27 | documentation => 'Start station', | ||||||||||||||||||||
| 28 | required => 1, | ||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||
| 30 | 1 | parameter destination => ( | |||||||||||||||||||
| 31 | is => 'rw', | ||||||||||||||||||||
| 32 | isa => Str, | ||||||||||||||||||||
| 33 | documentation => 'Final station', | ||||||||||||||||||||
| 34 | required => 1, | ||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | 1 | command_short_description 'Search in a map'; | |||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 0 | ▶ | sub run { | ||||||||||||||||||
|
Subroutine
run: not called CC=2 SCAR=17.9
| |||||||||||||||||||||
| 40 | 0 | my $self = shift; | |||||||||||||||||||
| 41 | |||||||||||||||||||||
| 42 | 0 | my %hooks = (hooks => ['PrettyPrinter']); | |||||||||||||||||||
| 43 | 0 | ▶ | my $graph = $self->cityname !~ m{\.} ? Map::Metro->new($self->cityname, %hooks)->parse : Map::Metro::Shim->new($self->cityname, %hooks)->parse; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 44 | |||||||||||||||||||||
| 45 | 0 | ▶ | try { | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||
| 46 | 0 | $graph->routing_for($self->origin, $self->destination); | |||||||||||||||||||
| 47 | } | ||||||||||||||||||||
| 48 | 0 | ▶ | catch { | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||
| 49 | 0 | my $error = $_; | |||||||||||||||||||
| 50 | 0 | say sprintf q{Try search by station id. Run '%s stations %s' to see station ids.}, $0, $self->cityname; | |||||||||||||||||||
| 51 | 0 | ▶ | die($_->$_call_if_object('desc') || $_); | ||||||||||||||||||
|
Condition0%0/3
$_->$Map::Metro::Cmd::Route::_call_if_object('desc') || $_
MC/DC0%0/2
$_->$Map::Metro::Cmd::Route::_call_if_object('desc') || $_
$_->$Map::Metro::Cmd::Route::_call_if_object('desc')
$_
Truth table0%0/3
A || B
A= $_->$Map::Metro::Cmd::Route::_call_if_object('desc')B= $_
| |||||||||||||||||||||
| 52 | 0 | }; | |||||||||||||||||||
| 53 | } | ||||||||||||||||||||
| 54 | |||||||||||||||||||||
| 55 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||
| 56 | |||||||||||||||||||||
| 57 | 1 | 1; | |||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | __END__ | ||||||||||||||||||||