summaryrefslogtreecommitdiff
path: root/lib/Travel/Status
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travel/Status')
-rw-r--r--lib/Travel/Status/DE/IRIS.pm17
1 files changed, 15 insertions, 2 deletions
diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm
index 2d4d068..03aa89c 100644
--- a/lib/Travel/Status/DE/IRIS.pm
+++ b/lib/Travel/Status/DE/IRIS.pm
@@ -30,7 +30,8 @@ sub new {
// DateTime->now( time_zone => 'Europe/Berlin' ),
iris_base => $opt{iris_base}
// 'http://iris.noncd.db.de/iris-tts/timetable',
- station => $opt{station},
+ lookahead => $opt{lookahead} // ( 4 * 60 ),
+ station => $opt{station},
user_agent => $ua,
};
@@ -68,7 +69,7 @@ sub new {
my $d
= ( $_->departure // $_->arrival )
->subtract_datetime( $self->{datetime} );
- not $d->is_negative and $d->in_units('hours') < 4
+ not $d->is_negative and $d->in_units('minutes') < $self->{lookahead}
} @{ $self->{results} };
@{ $self->{results} }
@@ -303,6 +304,18 @@ current date and time.
IRIS base url, defaults to C<< http://iris.noncd.db.de/iris-tts/timetable >>.
+=item B<lookahead> => I<int>
+
+Compute only those results which are less than I<int> minutes in the future.
+Default: 240 (4 hours).
+
+Note that the DeutscheBahn IRIS backend only provides schedules up to four
+to five hours into the future, and this module only requests data for up to
+three hours. So in most cases, setting this to a value above 180 minutes will
+have no effect. However, as the IRIS occasionally contains unscheduled
+departures or qos messages known far in advance (e.g. 12 hours from now), any
+non-negative integer is accepted.
+
=item B<station> => I<stationcode>
Mandatory: Which station to return departures for. Note that this is not a