| 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::Line; | ||||||||||
| 6 | |||||||||||
| 7 | # ABSTRACT: Meta information about a line | ||||||||||
| 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/Str Int/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 14 | ▶ | use Map::Metro::Exceptions; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 14 | |||||||||||
| 15 | 14 | has id => ( | |||||||||
| 16 | is => 'ro', | ||||||||||
| 17 | isa => Str, | ||||||||||
| 18 | required => 1, | ||||||||||
| 19 | ); | ||||||||||
| 20 | 14 | has name => ( | |||||||||
| 21 | is => 'ro', | ||||||||||
| 22 | isa => Str, | ||||||||||
| 23 | required => 1, | ||||||||||
| 24 | ); | ||||||||||
| 25 | 14 | has description => ( | |||||||||
| 26 | is => 'ro', | ||||||||||
| 27 | isa => Str, | ||||||||||
| 28 | required => 1, | ||||||||||
| 29 | ); | ||||||||||
| 30 | 14 | has color => ( | |||||||||
| 31 | is => 'rw', | ||||||||||
| 32 | isa => Str, | ||||||||||
| 33 | default => '#333333', | ||||||||||
| 34 | ); | ||||||||||
| 35 | 14 | has width => ( | |||||||||
| 36 | is => 'rw', | ||||||||||
| 37 | isa => Int, | ||||||||||
| 38 | default => 3, | ||||||||||
| 39 | ); | ||||||||||
| 40 | |||||||||||
| 41 | 8 | ▶ | around BUILDARGS => sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.2
| |||||||||||
| 42 | 8 | my $orig = shift; | |||||||||
| 43 | 8 | my $self = shift; | |||||||||
| 44 | 8 | my %args = @_; | |||||||||
| 45 | |||||||||||
| 46 | 8 | ▶ | if($args{'id'} =~ m{([^a-z0-9])}i) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 0 | die lineid_contains_illegal_character line_id => $args{'id'}, illegal_character => $_; | |||||||||
| 48 | } | ||||||||||
| 49 | 8 | $self->$orig(%args); | |||||||||
| 50 | 14 | }; | |||||||||
| 51 | |||||||||||
| 52 | 22 | ▶ | sub to_hash { | ||||||||
|
Subroutine
to_hash: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 53 | 22 | my $self = shift; | |||||||||
| 54 | |||||||||||
| 55 | return { | ||||||||||
| 56 | 22 | id => $self->id, | |||||||||
| 57 | name => $self->name, | ||||||||||
| 58 | description => $self->description, | ||||||||||
| 59 | color => $self->color, | ||||||||||
| 60 | width => $self->width, | ||||||||||
| 61 | } | ||||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | 14 | __PACKAGE__->meta->make_immutable; | |||||||||
| 65 | |||||||||||
| 66 | 14 | 1; | |||||||||
| 67 | |||||||||||
| 68 | __END__ | ||||||||||