summaryrefslogtreecommitdiff
path: root/lib/Travel/Status/DE/IRIS.pm
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2013-12-21 16:39:14 +0100
committerDaniel Friesel <derf@finalrewind.org>2013-12-21 16:39:14 +0100
commite360b55ec5d4d9e725510400a2ecd14dd14fb8c5 (patch)
tree9d44e57656252ae811c86b75b0cf2dd699b50077 /lib/Travel/Status/DE/IRIS.pm
parent4ad2215299f32dc4264202055f7d79d06c796a24 (diff)
Result: Remove _date, _time accessors, add more route support
Diffstat (limited to 'lib/Travel/Status/DE/IRIS.pm')
-rw-r--r--lib/Travel/Status/DE/IRIS.pm11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm
index 7cb35ea..16883a4 100644
--- a/lib/Travel/Status/DE/IRIS.pm
+++ b/lib/Travel/Status/DE/IRIS.pm
@@ -53,6 +53,9 @@ sub new {
$dt_req->add( hours => 1 );
}
+ @{ $self->{results} }
+ = sort { $a->{datetime} <=> $b->{datetime} } @{ $self->{results} };
+
return $self;
}
@@ -60,9 +63,6 @@ sub get_timetable {
my ( $self, $eva, $dt ) = @_;
my $ua = $self->{user_agent};
- say $dt->strftime(
- "http://iris.noncd.db.de/iris-tts/timetable/plan/${eva}/%y%m%d/%H");
-
my $res = $ua->get(
$dt->strftime(
"http://iris.noncd.db.de/iris-tts/timetable/plan/${eva}/%y%m%d/%H")
@@ -75,6 +75,8 @@ sub get_timetable {
my $xml = XML::LibXML->load_xml( string => $res->decoded_content );
+ my $station = ( $xml->findnodes('/timetable') )[0]->getAttribute('station');
+
for my $s ( $xml->findnodes('/timetable/s') ) {
my $id = $s->getAttribute('id');
my $e_tl = ( $s->findnodes('./tl') )[0];
@@ -92,6 +94,7 @@ sub get_timetable {
train_no => $e_tl->getAttribute('n'), # dep number
type => $e_tl->getAttribute('c'), # S/ICE/ERB/...
line_no => $e_tl->getAttribute('l'), # 1 -> S1, ...
+ station => $station,
unknown_o => $e_tl->getAttribute('o'), # owner: 03/80/R2/...
);
@@ -115,8 +118,6 @@ sub get_timetable {
);
}
- say $xml->toString(1);
-
return $self;
}