diff --git a/bin/db-ris b/bin/db-ris index 95e1c6e5719842f8a339dc852a380caae37403f2..c2c76d14dd5e405e416beca36ca6fd6c9007a6a5 100755 --- a/bin/db-ris +++ b/bin/db-ris @@ -5,9 +5,21 @@ use 5.010; our $VERSION = '0.0'; +use Getopt::Long; use Travel::Status::DE::DeutscheBahn; -my $status = Travel::Status::DE::DeutscheBahn->new( station => shift, ); +my ( $date, $time ); + +GetOptions( + 'd|date=s' => \$date, + 't|time=s' => \$time, +); + +my $status = Travel::Status::DE::DeutscheBahn->new( + date => $date, + station => shift, + time => $time, +); for my $d ( $status->departures() ) { diff --git a/lib/Travel/Status/DE/DeutscheBahn.pm b/lib/Travel/Status/DE/DeutscheBahn.pm index 55b82dd01d74b3dd55b3b473645d7c51af20b0ad..32c017df467222c74eb4612bf5ce3d9c776627d5 100644 --- a/lib/Travel/Status/DE/DeutscheBahn.pm +++ b/lib/Travel/Status/DE/DeutscheBahn.pm @@ -105,7 +105,7 @@ sub departures { my $route = $n_route->textContent(); my $dest = $n_dest->textContent(); my $platform = $n_platform->textContent(); - my $info = $n_info->textContent(); + my $info = $n_info ? $n_info->textContent() : q{}; my @via; for my $str ( $time, $train, $dest, $platform, $info ) {