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 2     2   10 use strict;
  2         3  
  2         54  
4 2     2   9 use warnings;
  2         4  
  2         52  
5              
6 2     2   10 use Carp qw(croak);
  2         4  
  2         204  
7              
8             our @ATTR = qw(
9             address
10             bicycle_cage
11             bicycle_lockers
12             bicycle_racks
13             car_parking
14             escalator
15             hearing_loop
16             id
17             latitude
18             lift
19             lighting
20             lines
21             locality
22             lockers
23             longitude
24             map_ref
25             municipiality
26             municipiality_id
27             myki_checks
28             myki_machines
29             phone_feedback
30             phone_station
31             postcode
32             public_phone
33             public_toilet
34             routes
35             seating
36             staff_hours
37             stairs
38             street
39             tactile_paths
40             taxi_rank
41             transport_type
42             vline_bookings
43             waiting_area_indoor
44             waiting_area_sheltered
45             wheelchair_accessible
46             zone
47             );
48              
49             foreach my $attr ( @ATTR ) {
50 2     2   10 no strict 'refs';
  2         15  
  2         601  
51              
52             *{ __PACKAGE__ .'::'. $attr } = sub {
53 0     0     my( $self, $val ) = @_;
54 0 0         $self->{$attr} = $val if $val;
55 0           return $self->{$attr}
56             }
57             }
58              
59             sub new {
60 0     0 0   my( $class, %args ) = @_;
61              
62 0           my $self = bless {}, $class;
63             $args{ id }
64 0 0         or croak 'Constructor failed: mandatory id argument not supplied';
65              
66 0           foreach my $attr ( @ATTR ) {
67 0           $self->{$attr} = $args{$attr}
68             }
69              
70 0           return $self
71             }
72              
73             sub get_route_names {
74 0     0 1   map { $_->{name} } @{ $_[0]->{routes} }
  0            
  0            
75             }
76              
77             sub get_route_ids {
78 0     0 1   map { $_->{id} } @{ $_[0]->{routes} }
  0            
  0            
79             }
80              
81             sub get_routes {
82 0     0 1   my $self = shift;
83              
84             return wantarray
85 0           ? @{ $self->{routes} }
86             : $self->{routes}
87 0 0         }
88              
89             1;
90              
91             __END__