| 1 | package WWW::PTV::Area; | ||||||||||
| 2 | |||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 2 | our $VERSION = '0.05'; | |||||||||
| 7 | |||||||||||
| 8 | sub new { | ||||||||||
| 9 | 0 | ▶ | my ($class, %args) = @_; | ||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 10 | 0 | my $self = bless {}, $class; | |||||||||
| 11 | 0 | $self->{id} = $args{id}; | |||||||||
| 12 | 0 | $self->{name} = $args{name}; | |||||||||
| 13 | 0 | $self->{suburbs}= $args{suburbs}; | |||||||||
| 14 | 0 | $self->{service}= $args{service}; | |||||||||
| 15 | 0 | return $self | |||||||||
| 16 | } | ||||||||||
| 17 | |||||||||||
| 18 | sub id { | ||||||||||
| 19 | return $_[0]->{id} | ||||||||||
| 20 | 0 | ▶ | } | ||||||||
|
Subroutine
id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 21 | |||||||||||
| 22 | sub name { | ||||||||||
| 23 | return $_[0]->{name} | ||||||||||
| 24 | 0 | ▶ | } | ||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 25 | |||||||||||
| 26 | sub suburbs { | ||||||||||
| 27 | return $_[0]->{suburbs} | ||||||||||
| 28 | 0 | ▶ | } | ||||||||
|
Subroutine
suburbs: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 29 | |||||||||||
| 30 | sub towns { | ||||||||||
| 31 | 0 | ▶ | $_[0]->suburbs | ||||||||
|
Subroutine
towns: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | sub service_types { | ||||||||||
| 35 | 0 | ▶ | return keys %{ $_[0]->{service}{names} } | ||||||||
|
Subroutine
service_types: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | sub service_names { | ||||||||||
| 39 | return $_[0]->{service}{names} | ||||||||||
| 40 | 0 | ▶ | } | ||||||||
|
Subroutine
service_names: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 41 | |||||||||||
| 42 | sub service_links { | ||||||||||
| 43 | return $_[0]->{service}{links} | ||||||||||
| 44 | 0 | ▶ | } | ||||||||
|
Subroutine
service_links: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 45 | |||||||||||
| 46 | sub services { | ||||||||||
| 47 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
services: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||
| 48 | 0 | my @res; | |||||||||
| 49 | 0 | my $service_names = $self->service_names; | |||||||||
| 50 | 0 | my $service_links = $self->service_links; | |||||||||
| 51 | |||||||||||
| 52 | # { name => 'Name', link => 'link', type => 'Type' } | ||||||||||
| 53 | 0 | foreach my $type ( $self->service_types ) { | |||||||||
| 54 | 0 | my $c = 0; | |||||||||
| 55 | 0 | my $r; | |||||||||
| 56 | |||||||||||
| 57 | 0 | foreach my $service ( @{ $service_names->{$type} } ) { | |||||||||
| 58 | my $r = { type => $type, | ||||||||||
| 59 | 0 | name => @{ $service_names->{ $type } }[ $c ], | |||||||||
| 60 | 0 | link => @{ $service_links->{ $type } }[ $c ] }; | |||||||||
| 61 | 0 | push @res, $r; | |||||||||
| 62 | 0 | $c++; | |||||||||
| 63 | } | ||||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | 0 | return @res; | |||||||||
| 67 | } | ||||||||||
| 68 | |||||||||||
| 69 | sub services_like { | ||||||||||
| 70 | 0 | ▶ | my ( $self, %args ) = @_; | ||||||||
|
Subroutine
services_like: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 71 | 0 | ▶ | $args{type} or return grep { $_->{name} =~ /$args{name}/i } $self->services; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 72 | 0 | ▶ | $args{name} or return grep { $_->{type} =~ /$args{type}/i } $self->services; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 73 | |||||||||||
| 74 | 0 | return grep { $_->{type} =~ /$args{type}/i | |||||||||
| 75 | 0 | ▶ | and $_->{name} =~ /$args{name}/i | ||||||||
|
Branch: 1 branch
| |||||||||||
| 76 | } $self->services | ||||||||||
| 77 | } | ||||||||||
| 78 | |||||||||||
| 79 | 2 | 1; | |||||||||
| 80 | |||||||||||
| 81 | __END__ | ||||||||||