line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Travel::Status::DE::URA::Result; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
17
|
use strict; |
|
5
|
|
|
|
|
4
|
|
|
5
|
|
|
|
|
110
|
|
4
|
5
|
|
|
5
|
|
14
|
use warnings; |
|
5
|
|
|
|
|
4
|
|
|
5
|
|
|
|
|
91
|
|
5
|
5
|
|
|
5
|
|
65
|
use 5.010; |
|
5
|
|
|
|
|
10
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
12
|
use parent 'Class::Accessor'; |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
27
|
|
8
|
|
|
|
|
|
|
|
9
|
5
|
|
|
5
|
|
10780
|
use DateTime::Format::Duration; |
|
5
|
|
|
|
|
19833
|
|
|
5
|
|
|
|
|
2386
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '2.00'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Travel::Status::DE::URA::Result->mk_ro_accessors( |
14
|
|
|
|
|
|
|
qw(datetime destination line line_id stop stop_id stop_indicator)); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
17
|
33161
|
|
|
33161
|
1
|
144627
|
my ( $obj, %conf ) = @_; |
18
|
|
|
|
|
|
|
|
19
|
33161
|
|
|
|
|
32855
|
my $ref = \%conf; |
20
|
|
|
|
|
|
|
|
21
|
33161
|
|
|
|
|
99464
|
return bless( $ref, $obj ); |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub countdown { |
25
|
2
|
|
|
2
|
1
|
613
|
my ($self) = @_; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
$self->{countdown} //= $self->datetime->subtract_datetime( $self->{dt_now} ) |
28
|
2
|
|
66
|
|
|
20
|
->in_units('minutes'); |
29
|
|
|
|
|
|
|
|
30
|
2
|
|
|
|
|
515
|
return $self->{countdown}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub countdown_sec { |
34
|
2
|
|
|
2
|
1
|
5
|
my ($self) = @_; |
35
|
2
|
|
|
|
|
13
|
my $secpattern = DateTime::Format::Duration->new( pattern => '%s' ); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
$self->{countdown_sec} //= $secpattern->format_duration( |
38
|
2
|
|
66
|
|
|
72
|
$self->datetime->subtract_datetime( $self->{dt_now} ) ); |
39
|
|
|
|
|
|
|
|
40
|
2
|
|
|
|
|
413
|
return $self->{countdown_sec}; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub date { |
44
|
1
|
|
|
1
|
1
|
2
|
my ($self) = @_; |
45
|
|
|
|
|
|
|
|
46
|
1
|
|
|
|
|
4
|
return $self->datetime->strftime('%d.%m.%Y'); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub platform { |
50
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
0
|
return $self->{stop_indicator}; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
sub time { |
56
|
1
|
|
|
1
|
1
|
708
|
my ($self) = @_; |
57
|
|
|
|
|
|
|
|
58
|
1
|
|
|
|
|
4
|
return $self->datetime->strftime('%H:%M:%S'); |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub type { |
62
|
1
|
|
|
1
|
1
|
414
|
return 'Bus'; |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub route_interesting { |
66
|
15
|
|
|
15
|
1
|
3809
|
my ( $self, $max_parts ) = @_; |
67
|
|
|
|
|
|
|
|
68
|
15
|
|
|
|
|
28
|
my @via = $self->route_post; |
69
|
15
|
|
|
|
|
25
|
my ( @via_main, @via_show, $last_stop ); |
70
|
15
|
|
100
|
|
|
39
|
$max_parts //= 3; |
71
|
|
|
|
|
|
|
|
72
|
15
|
|
|
|
|
23
|
for my $stop (@via) { |
73
|
660
|
100
|
|
|
|
4866
|
if ( |
74
|
|
|
|
|
|
|
$stop->name =~ m{ bf | hbf | Flughafen | bahnhof |
75
|
|
|
|
|
|
|
| Krankenhaus | Klinik | bushof | busstation }iox |
76
|
|
|
|
|
|
|
) |
77
|
|
|
|
|
|
|
{ |
78
|
30
|
|
|
|
|
240
|
push( @via_main, $stop ); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
} |
81
|
15
|
|
|
|
|
122
|
$last_stop = pop(@via); |
82
|
|
|
|
|
|
|
|
83
|
15
|
50
|
33
|
|
|
67
|
if ( @via_main and $via_main[-1] == $last_stop ) { |
84
|
0
|
|
|
|
|
0
|
pop(@via_main); |
85
|
|
|
|
|
|
|
} |
86
|
15
|
50
|
33
|
|
|
46
|
if ( @via and $via[-1] == $last_stop ) { |
87
|
0
|
|
|
|
|
0
|
pop(@via); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
15
|
50
|
33
|
|
|
70
|
if ( @via_main and @via and $via[0] == $via_main[0] ) { |
|
|
|
33
|
|
|
|
|
91
|
0
|
|
|
|
|
0
|
shift(@via_main); |
92
|
|
|
|
|
|
|
} |
93
|
|
|
|
|
|
|
|
94
|
15
|
50
|
|
|
|
24
|
if ( @via < $max_parts ) { |
95
|
0
|
|
|
|
|
0
|
@via_show = @via; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
else { |
98
|
15
|
100
|
|
|
|
22
|
if ( @via_main >= $max_parts ) { |
99
|
5
|
|
|
|
|
8
|
@via_show = ( $via[0] ); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
else { |
102
|
10
|
|
|
|
|
21
|
@via_show = splice( @via, 0, $max_parts - @via_main ); |
103
|
|
|
|
|
|
|
} |
104
|
|
|
|
|
|
|
|
105
|
15
|
|
66
|
|
|
56
|
while ( @via_show < $max_parts and @via_main ) { |
106
|
23
|
|
|
|
|
22
|
my $stop = shift(@via_main); |
107
|
23
|
|
|
|
|
54
|
push( @via_show, $stop ); |
108
|
|
|
|
|
|
|
} |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
15
|
|
|
|
|
73
|
return @via_show; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
sub route_pre { |
115
|
1
|
|
|
1
|
1
|
2
|
my ($self) = @_; |
116
|
|
|
|
|
|
|
|
117
|
1
|
|
|
|
|
2
|
return @{ $self->{route_pre} }; |
|
1
|
|
|
|
|
6
|
|
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub route_post { |
121
|
31
|
|
|
31
|
1
|
5146
|
my ($self) = @_; |
122
|
|
|
|
|
|
|
|
123
|
31
|
|
|
|
|
25
|
return @{ $self->{route_post} }; |
|
31
|
|
|
|
|
211
|
|
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
sub TO_JSON { |
127
|
8
|
|
|
8
|
1
|
2193
|
my ($self) = @_; |
128
|
|
|
|
|
|
|
|
129
|
8
|
|
|
|
|
8
|
return { %{$self} }; |
|
8
|
|
|
|
|
81
|
|
130
|
|
|
|
|
|
|
} |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
1; |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
__END__ |