| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Travel::Status::DE::EFA::Stop; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
16
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
87
|
|
|
4
|
2
|
|
|
2
|
|
23
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
95
|
|
|
5
|
2
|
|
|
2
|
|
33
|
use 5.010; |
|
|
2
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
12
|
use parent 'Class::Accessor'; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
37
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '3.19'; |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Travel::Status::DE::EFA::Stop->mk_ro_accessors( |
|
12
|
|
|
|
|
|
|
qw(sched_arr rt_arr arr arr_delay |
|
13
|
|
|
|
|
|
|
sched_dep rt_dep dep dep_delay |
|
14
|
|
|
|
|
|
|
occupancy delay distance_m is_cancelled |
|
15
|
|
|
|
|
|
|
place name full_name id_num id_code latlon |
|
16
|
|
|
|
|
|
|
platform niveau) |
|
17
|
|
|
|
|
|
|
); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub new { |
|
20
|
6
|
|
|
6
|
1
|
41
|
my ( $obj, %conf ) = @_; |
|
21
|
|
|
|
|
|
|
|
|
22
|
6
|
|
|
|
|
16
|
my $ref = \%conf; |
|
23
|
|
|
|
|
|
|
|
|
24
|
6
|
0
|
33
|
|
|
22
|
if ( $ref->{sched_arr} and $ref->{arr_delay} and not $ref->{rt_arr} ) { |
|
|
|
|
0
|
|
|
|
|
|
25
|
|
|
|
|
|
|
$ref->{rt_arr} |
|
26
|
0
|
|
|
|
|
0
|
= $ref->{sched_arr}->clone->add( minutes => $ref->{arr_delay} ); |
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
6
|
0
|
33
|
|
|
18
|
if ( $ref->{sched_dep} and $ref->{dep_delay} and not $ref->{rt_dep} ) { |
|
|
|
|
0
|
|
|
|
|
|
30
|
|
|
|
|
|
|
$ref->{rt_dep} |
|
31
|
0
|
|
|
|
|
0
|
= $ref->{sched_dep}->clone->add( minutes => $ref->{dep_delay} ); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
|
|
34
|
6
|
|
33
|
|
|
49
|
$ref->{arr} //= $ref->{rt_arr} // $ref->{sched_arr}; |
|
|
|
|
33
|
|
|
|
|
|
35
|
6
|
|
33
|
|
|
64
|
$ref->{dep} //= $ref->{rt_dep} // $ref->{sched_dep}; |
|
|
|
|
33
|
|
|
|
|
|
36
|
|
|
|
|
|
|
|
|
37
|
6
|
0
|
33
|
|
|
14
|
if ( $ref->{rt_arr} |
|
|
|
|
0
|
|
|
|
|
|
38
|
|
|
|
|
|
|
and $ref->{sched_arr} |
|
39
|
|
|
|
|
|
|
and not defined $ref->{arr_delay} ) |
|
40
|
|
|
|
|
|
|
{ |
|
41
|
|
|
|
|
|
|
$ref->{arr_delay} |
|
42
|
|
|
|
|
|
|
= $ref->{rt_arr}->subtract_datetime( $ref->{sched_arr} ) |
|
43
|
0
|
|
|
|
|
0
|
->in_units('minutes'); |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
6
|
0
|
33
|
|
|
17
|
if ( $ref->{rt_dep} |
|
|
|
|
0
|
|
|
|
|
|
47
|
|
|
|
|
|
|
and $ref->{sched_dep} |
|
48
|
|
|
|
|
|
|
and not defined $ref->{dep_delay} ) |
|
49
|
|
|
|
|
|
|
{ |
|
50
|
|
|
|
|
|
|
$ref->{dep_delay} |
|
51
|
|
|
|
|
|
|
= $ref->{rt_dep}->subtract_datetime( $ref->{sched_dep} ) |
|
52
|
0
|
|
|
|
|
0
|
->in_units('minutes'); |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
|
|
55
|
6
|
|
33
|
|
|
22
|
$ref->{delay} = $ref->{dep_delay} // $ref->{arr_delay}; |
|
56
|
|
|
|
|
|
|
|
|
57
|
6
|
|
|
|
|
35
|
return bless( $ref, $obj ); |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub TO_JSON { |
|
61
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
62
|
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
my $ret = { %{$self} }; |
|
|
0
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
for my $k (qw(sched_arr rt_arr arr sched_dep rt_dep dep)) { |
|
66
|
0
|
0
|
|
|
|
|
if ( $ret->{$k} ) { |
|
67
|
0
|
|
|
|
|
|
$ret->{$k} = $ret->{$k}->epoch; |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
return $ret; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__END__ |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 NAME |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Travel::Status::DE::EFA::Stop - Information about a stop (station) contained |
|
81
|
|
|
|
|
|
|
in a Travel::Status::DE::EFA::Result's route |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
for my $stop ($departure->route_post) { |
|
86
|
|
|
|
|
|
|
printf( |
|
87
|
|
|
|
|
|
|
"%s -> %s : %40s %s\n", |
|
88
|
|
|
|
|
|
|
$stop->arr ? $stop->arr->strftime('%H:%M') : q{--:--}, |
|
89
|
|
|
|
|
|
|
$stop->dep ? $stop->dep->strftime('%H:%M') : q{--:--}, |
|
90
|
|
|
|
|
|
|
$stop->name, $stop->platform |
|
91
|
|
|
|
|
|
|
); |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 VERSION |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
version 3.19 |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Travel::Status::DE::EFA::Stop describes a single stop of a departure's |
|
101
|
|
|
|
|
|
|
route. It is solely based on the respective departure's schedule; |
|
102
|
|
|
|
|
|
|
delays or changed platforms are not taken into account. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 METHODS |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 ACCESSORS |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Most accessors return undef if the corresponding data is not available. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=over |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=item $stop->sched_arr |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
DateTime(3pm) object holding scheduled arrival date and time. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item $stop->rt_arr |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
DateTime(3pm) object holding estimated (real-time) arrival date and time. |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=item $stop->arr |
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
DateTime(3pm) object holding arrival date and time. Real-time data if |
|
123
|
|
|
|
|
|
|
available, schedule data otherwise. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=item $stop->arr_delay |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Arrival delay in minutes. |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=item $stop->sched_dep |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
DateTime(3pm) object holding scheduled departure date and time. |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=item $stop->rt_dep |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
DateTime(3pm) object holding estimated (real-time) departure date and time. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=item $stop->dep |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
DateTime(3pm) object holding departure date and time. Real-time data if |
|
140
|
|
|
|
|
|
|
available, schedule data otherwise. |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=item $stop->dep_delay |
|
143
|
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Departure delay in minutes. |
|
145
|
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=item $stop->delay |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Delay in minutes. Departure delya if available, arrival delay otherwise. |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=item $stop->distance_m |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Distance from request coordinates in meters. undef if the object has not |
|
153
|
|
|
|
|
|
|
been obtained by means of a coord request. |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=item $stop->id_num |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Stop ID (numeric). |
|
158
|
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=item $stop->id_code |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
Stop ID (code). |
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=item $stop->place |
|
164
|
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
Place or city name, for instance "Essen". |
|
166
|
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
=item $stop->full_name |
|
168
|
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
stop name with place or city prefix ("I<City> I<Stop>", for instance |
|
170
|
|
|
|
|
|
|
"Essen RE<uuml>ttenscheider Stern"). |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item $stop->name |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
stop name without place or city prefix, for instance "RE<uuml>ttenscheider Stern". |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=item $stop->latlon |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Arrayref describing the stop's latitude and longitude in WGS84 coordinates. |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=item $stop->platform |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
Platform name/number if available, empty string otherwise. |
|
183
|
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
=back |
|
185
|
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head2 INTERNAL |
|
187
|
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
=over |
|
189
|
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=item $stop = Travel::Status::DE::EFA::Stop->new(I<%data>) |
|
191
|
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
Returns a new Travel::Status::DE::EFA::Stop object. You should not need to |
|
193
|
|
|
|
|
|
|
call this. |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
=item $stop->TO_JSON |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
Allows the object data to be serialized to JSON. |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
=back |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=head1 DIAGNOSTICS |
|
202
|
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
None. |
|
204
|
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
=over |
|
208
|
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
=item Class::Accessor(3pm) |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=back |
|
212
|
|
|
|
|
|
|
|
|
213
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
|
214
|
|
|
|
|
|
|
|
|
215
|
|
|
|
|
|
|
This module is a Work in Progress. |
|
216
|
|
|
|
|
|
|
Its API may change between minor versions. |
|
217
|
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
219
|
|
|
|
|
|
|
|
|
220
|
|
|
|
|
|
|
Travel::Status::DE::EFA(3pm). |
|
221
|
|
|
|
|
|
|
|
|
222
|
|
|
|
|
|
|
=head1 AUTHOR |
|
223
|
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
Copyright (C) 2015-2025 Birte Kristina Friesel E<lt>derf@finalrewind.orgE<gt> |
|
225
|
|
|
|
|
|
|
|
|
226
|
|
|
|
|
|
|
=head1 LICENSE |
|
227
|
|
|
|
|
|
|
|
|
228
|
|
|
|
|
|
|
This module is licensed under the same terms as Perl itself. |