File Coverage

blib/lib/WWW/PTV/Stop.pm
Criterion Covered Total %
statement 12 30 40.0
branch 0 6 0.0
condition n/a
subroutine 4 9 44.4
pod 3 4 75.0
total 19 49 38.7


line stmt bran cond sub pod time code
1             package WWW::PTV::Stop;
2              
3 1     1   6 use strict;
  1         2  
  1         42  
4 1     1   6 use warnings;
  1         3  
  1         31  
5              
6 1     1   6 use Carp qw(croak);
  1         2  
  1         139  
7              
8             our $VERSION = '0.05';
9              
10             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             foreach my $attr ( @ATTR ) {
19             {
20 1     1   16 no strict 'refs';
  1         2  
  1         789  
21             *{ __PACKAGE__ .'::'. $attr } = sub {
22 0     0     my( $self, $val ) = @_;
23 0 0         $self->{$attr} = $val if $val;
24 0           return $self->{$attr}
25             }
26             }
27             }
28              
29             sub new {
30 0     0 0   my( $class, %args ) = @_;
31 0           my $self = bless {}, $class;
32 0 0         $args{id} or croak 'Constructor failed: mandatory id argument not supplied';
33              
34 0           foreach my $attr ( @ATTR ) { $self->{$attr} = $args{$attr} }
  0            
35              
36 0           return $self
37             }
38              
39             sub get_route_names {
40 0     0 1   map { $_->{name} } @{ $_[0]->{routes} }
  0            
  0            
41             }
42              
43             sub get_route_ids {
44 0     0 1   map { $_->{id} } @{ $_[0]->{routes} }
  0            
  0            
45             }
46              
47             sub get_routes {
48 0     0 1   my $self = shift;
49             return wantarray
50 0 0         ? @{ $self->{routes} }
  0            
51             : $self->{routes}
52             }
53              
54             1;
55              
56             __END__