| 1 | package WWW::PTV::Stop; | ||||||||||
| 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 | ▶ | use Carp qw(croak); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 2 | our $VERSION = '0.05'; | |||||||||
| 9 | |||||||||||
| 10 | 2 | our @ATTR = qw( address bicycle_cage bicycle_lockers bicycle_racks car_parking | |||||||||
| 11 | escalator hearing_loop id latitude lift lighting lines | ||||||||||
| 12 | locality lockers longitude map_ref municipiality municipiality_id | ||||||||||
| 13 | myki_checks myki_machines phone_feedback phone_station postcode | ||||||||||
| 14 | public_phone public_toilet routes seating staff_hours stairs street | ||||||||||
| 15 | tactile_paths taxi_rank transport_type vline_bookings waiting_area_indoor | ||||||||||
| 16 | waiting_area_sheltered wheelchair_accessible zone ); | ||||||||||
| 17 | |||||||||||
| 18 | 2 | foreach my $attr ( @ATTR ) { | |||||||||
| 19 | { | ||||||||||
| 20 | 2 | ▶ | no strict 'refs'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 76 | *{ __PACKAGE__ .'::'. $attr } = sub { | |||||||||
| 22 | 0 | ▶ | my( $self, $val ) = @_; | ||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||
| 23 | 0 | ▶ | $self->{$attr} = $val if $val; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | 0 | return $self->{$attr} | |||||||||
| 25 | } | ||||||||||
| 26 | 76 | } | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | sub new { | ||||||||||
| 30 | 0 | ▶ | my( $class, %args ) = @_; | ||||||||
|
Subroutine
new: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 31 | 0 | my $self = bless {}, $class; | |||||||||
| 32 | 0 | ▶ | $args{id} or croak 'Constructor failed: mandatory id argument not supplied'; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 33 | |||||||||||
| 34 | 0 | foreach my $attr ( @ATTR ) { $self->{$attr} = $args{$attr} } | |||||||||
| 35 | |||||||||||
| 36 | 0 | return $self | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | sub get_route_names { | ||||||||||
| 40 | 0 | ▶ | map { $_->{name} } @{ $_[0]->{routes} } | ||||||||
|
Subroutine
get_route_names: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 41 | } | ||||||||||
| 42 | |||||||||||
| 43 | sub get_route_ids { | ||||||||||
| 44 | 0 | ▶ | map { $_->{id} } @{ $_[0]->{routes} } | ||||||||
|
Subroutine
get_route_ids: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | sub get_routes { | ||||||||||
| 48 | 0 | ▶ | my $self = shift; | ||||||||
|
Subroutine
get_routes: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 49 | return wantarray | ||||||||||
| 50 | 0 | ? @{ $self->{routes} } | |||||||||
| 51 | : $self->{routes} | ||||||||||
| 52 | 0 | ▶ | } | ||||||||
|
Branch: 1 branch
| |||||||||||
| 53 | |||||||||||
| 54 | 2 | 1; | |||||||||
| 55 | |||||||||||
| 56 | __END__ | ||||||||||