| 1 | 14 | ▶ | use 5.10.0; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 2 | 14 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 14 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | package Map::Metro::Graph::Segment; | ||
| 6 | |||
| 7 | # ABSTRACT: All lines between two neighboring stations | ||
| 8 | 14 | our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY | |
| 9 | 14 | our $VERSION = '0.2405'; | |
| 10 | |||
| 11 | 14 | ▶ | use Map::Metro::Elk; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 12 | 14 | ▶ | use Types::Standard qw/ArrayRef Str Bool/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 13 | 14 | ▶ | use Map::Metro::Types qw/Station/; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | has line_ids => ( | ||
| 16 | is => 'ro', | ||
| 17 | isa => ArrayRef[Str], | ||
| 18 | traits => ['Array'], | ||
| 19 | required => 1, | ||
| 20 | 0 | ▶ | default => sub { [] }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 21 | 14 | handles => { | |
| 22 | all_line_ids => 'elements', | ||
| 23 | } | ||
| 24 | ); | ||
| 25 | 14 | has origin_station => ( | |
| 26 | is => 'ro', | ||
| 27 | isa => Station, | ||
| 28 | required => 1, | ||
| 29 | ); | ||
| 30 | 14 | has destination_station => ( | |
| 31 | is => 'ro', | ||
| 32 | isa => Station, | ||
| 33 | required => 1, | ||
| 34 | ); | ||
| 35 | 14 | has is_one_way => ( | |
| 36 | is => 'ro', | ||
| 37 | isa => Bool, | ||
| 38 | default => 0, | ||
| 39 | ); | ||
| 40 | |||
| 41 | 0 | ▶ | sub to_hash { |
|
Subroutine
to_hash: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 42 | 0 | my $self = shift; | |
| 43 | |||
| 44 | return { | ||
| 45 | 0 | line_ids => [ $self->all_line_ids ], | |
| 46 | origin_station => $self->origin_station->to_hash, | ||
| 47 | destination_station => $self->destination_station->to_hash, | ||
| 48 | is_one_way => $self->is_one_way, | ||
| 49 | }; | ||
| 50 | } | ||
| 51 | |||
| 52 | 14 | __PACKAGE__->meta->make_immutable; | |
| 53 | |||
| 54 | 14 | 1; | |
| 55 | |||
| 56 | __END__ | ||