Loading Changelog +4 −0 Original line number Diff line number Diff line git HEAD * Detect ambiguous input errors (available via errstr) * Add language switch for additional information (german/english) * Result: Add line (== train) and date accessors [db-ris] * Add -l / --lang option Travel::Status::DE::DeutscheBahn 1.00 - Sun Sep 04 2011 [db-ris] Loading bin/db-ris +13 −5 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ my $filter_via; my $ignore_late = 0; my $show_full_route = 0; my $types = q{}; my $language; my @output; Loading @@ -25,6 +26,7 @@ GetOptions( 'd|date=s' => \$date, 'f|full-route' => \$show_full_route, 'h|help' => sub { show_help(0) }, 'l|lang=s' => \$language, 'L|ignore-late' => \$ignore_late, 'm|mot=s' => \$types, 't|time=s' => \$time, Loading @@ -44,6 +46,7 @@ for my $type ( split( qr{,}, $types ) ) { my $status = Travel::Status::DE::DeutscheBahn->new( date => $date, language => $language, mot => \%train_type, station => shift || show_help(1), time => $time, Loading Loading @@ -164,6 +167,11 @@ Date to list departures for. Default: today. Display complete routes (including arrival times) of all trains. =item B<-l>, B<--lang> B<d>|B<e>|B<i>|B<n> Set language used for additional information. Supports B<d>eutsch (default), B<e>nglish, B<i>talian and dutch (B<n>). =item B<-L>, B<--ignore-late> Do not display delayed trains. Loading @@ -185,7 +193,7 @@ argements: You can prefix an argument with "!" to hide it. The default is C<< ice,ic_ec,d,nv,s >>. Note that B<-m> does not replace the default, so if you only want to see S-Bahn und U-Bahn departures, you'd have to use C<< -m only want to see S-Bahn and U-Bahn departures, you'd have to use C<< -m !ice,!ic_ec,!d,!nv,u >>. =item B<-t>, B<--time> I<hh>:I<mm> Loading lib/Travel/Status/DE/DeutscheBahn.pm +14 −4 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ sub new { my $reply; my $lang = $conf{language} // 'd'; if ( not $conf{station} ) { confess('You need to specify a station'); } Loading @@ -45,6 +47,7 @@ sub new { REQTrain_name => q{}, start => 'yes', boardType => $conf{mode} // 'dep', # L => 'vs_java3', }, }; Loading @@ -57,7 +60,9 @@ sub new { bless( $ref, $obj ); $reply = $ua->post( 'http://reiseauskunft.bahn.de/bin/bhftafel.exe/dn?rt=1', $reply = $ua->post( "http://reiseauskunft.bahn.de/bin/bhftafel.exe/${lang}n?rt=1", $ref->{post} ); if ( $reply->is_error ) { Loading Loading @@ -311,6 +316,11 @@ The train station to report for, e.g. "Essen HBf". Mandatory. Date to report for. Defaults to the current day. =item B<language> => I<language> Set language for additional information. Accepted arguments: B<d>eutsch, B<e>nglish, B<i>talian, B<n> (dutch). =item B<time> => I<hh>:I<mm> Time to report for. Defaults to now. Loading lib/Travel/Status/DE/DeutscheBahn/Result.pm +2 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,8 @@ sub info { $info =~ s{ ,Grund }{}ox; $info =~ s{ ^ \s+ }{}ox; $info =~ s{ (?: ^ | , ) (?: p.nktlich | k [.] A [.] ) }{}ox; $info =~ s{ (?: ^ | , ) (?: p.nktlich | [nk] [.] [Aa] [.] | on \s time ) }{}ox; $info =~ s{ ^ , }{}ox; return $info; Loading Loading
Changelog +4 −0 Original line number Diff line number Diff line git HEAD * Detect ambiguous input errors (available via errstr) * Add language switch for additional information (german/english) * Result: Add line (== train) and date accessors [db-ris] * Add -l / --lang option Travel::Status::DE::DeutscheBahn 1.00 - Sun Sep 04 2011 [db-ris] Loading
bin/db-ris +13 −5 Original line number Diff line number Diff line Loading @@ -16,6 +16,7 @@ my $filter_via; my $ignore_late = 0; my $show_full_route = 0; my $types = q{}; my $language; my @output; Loading @@ -25,6 +26,7 @@ GetOptions( 'd|date=s' => \$date, 'f|full-route' => \$show_full_route, 'h|help' => sub { show_help(0) }, 'l|lang=s' => \$language, 'L|ignore-late' => \$ignore_late, 'm|mot=s' => \$types, 't|time=s' => \$time, Loading @@ -44,6 +46,7 @@ for my $type ( split( qr{,}, $types ) ) { my $status = Travel::Status::DE::DeutscheBahn->new( date => $date, language => $language, mot => \%train_type, station => shift || show_help(1), time => $time, Loading Loading @@ -164,6 +167,11 @@ Date to list departures for. Default: today. Display complete routes (including arrival times) of all trains. =item B<-l>, B<--lang> B<d>|B<e>|B<i>|B<n> Set language used for additional information. Supports B<d>eutsch (default), B<e>nglish, B<i>talian and dutch (B<n>). =item B<-L>, B<--ignore-late> Do not display delayed trains. Loading @@ -185,7 +193,7 @@ argements: You can prefix an argument with "!" to hide it. The default is C<< ice,ic_ec,d,nv,s >>. Note that B<-m> does not replace the default, so if you only want to see S-Bahn und U-Bahn departures, you'd have to use C<< -m only want to see S-Bahn and U-Bahn departures, you'd have to use C<< -m !ice,!ic_ec,!d,!nv,u >>. =item B<-t>, B<--time> I<hh>:I<mm> Loading
lib/Travel/Status/DE/DeutscheBahn.pm +14 −4 Original line number Diff line number Diff line Loading @@ -21,6 +21,8 @@ sub new { my $reply; my $lang = $conf{language} // 'd'; if ( not $conf{station} ) { confess('You need to specify a station'); } Loading @@ -45,6 +47,7 @@ sub new { REQTrain_name => q{}, start => 'yes', boardType => $conf{mode} // 'dep', # L => 'vs_java3', }, }; Loading @@ -57,7 +60,9 @@ sub new { bless( $ref, $obj ); $reply = $ua->post( 'http://reiseauskunft.bahn.de/bin/bhftafel.exe/dn?rt=1', $reply = $ua->post( "http://reiseauskunft.bahn.de/bin/bhftafel.exe/${lang}n?rt=1", $ref->{post} ); if ( $reply->is_error ) { Loading Loading @@ -311,6 +316,11 @@ The train station to report for, e.g. "Essen HBf". Mandatory. Date to report for. Defaults to the current day. =item B<language> => I<language> Set language for additional information. Accepted arguments: B<d>eutsch, B<e>nglish, B<i>talian, B<n> (dutch). =item B<time> => I<hh>:I<mm> Time to report for. Defaults to now. Loading
lib/Travel/Status/DE/DeutscheBahn/Result.pm +2 −1 Original line number Diff line number Diff line Loading @@ -38,7 +38,8 @@ sub info { $info =~ s{ ,Grund }{}ox; $info =~ s{ ^ \s+ }{}ox; $info =~ s{ (?: ^ | , ) (?: p.nktlich | k [.] A [.] ) }{}ox; $info =~ s{ (?: ^ | , ) (?: p.nktlich | [nk] [.] [Aa] [.] | on \s time ) }{}ox; $info =~ s{ ^ , }{}ox; return $info; Loading