Loading bin/efa-m +8 −2 Original line number Diff line number Diff line Loading @@ -105,17 +105,23 @@ if ( my $err = $status->errstr ) { for my $d ( $status->results ) { my $platform = $d->platform; if ( $d->platform_db ) { $platform .= ' (DB)'; } if ( ( @grep_lines and not( $d->line ~~ \@grep_lines ) ) or ( @grep_platforms and not( substr( $d->platform, 6 ) ~~ \@grep_platforms ) ) and not( $platform ~~ \@grep_platforms ) ) ) { next; } push( @output, [ $d->time, $d->platform, $d->line, $d->destination, $d->info ] ); [ $d->time, $platform, $d->line, $d->destination, $d->info ] ); } display_result(@output); Loading lib/Travel/Status/DE/VRR.pm +7 −0 Original line number Diff line number Diff line Loading @@ -187,12 +187,19 @@ sub results { my $countdown = $e->getAttribute('countdown'); my $delay = $e_info->getAttribute('delay') // 0; my $platform_is_db = 0; if ( $platform =~ s{ ^ \# }{}ox ) { $platform_is_db = 1; } push( @results, Travel::Status::DE::VRR::Result->new( date => $rdate, time => $rtime, platform => $platform, platform_db => $platform_is_db, line => $line, destination => decode( 'UTF-8', $dest ), countdown => $countdown, Loading lib/Travel/Status/DE/VRR/Result.pm +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ use parent 'Class::Accessor'; our $VERSION = '0.02'; Travel::Status::DE::VRR::Result->mk_ro_accessors( qw(countdown date delay destination info line platform sched_date sched_time time type) qw(countdown date delay destination info line platform platform_db sched_date sched_time time type) ); sub new { Loading t/20-vrr.t +6 −3 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ use utf8; use Encode qw(decode); use File::Slurp qw(slurp); use Test::More tests => 111; use Test::More tests => 114; BEGIN { use_ok('Travel::Status::DE::VRR'); Loading Loading @@ -35,7 +35,8 @@ is($results[0]->time, '09:40', 'first result: real time ok'); is($results[0]->delay, 4, 'first result: delay 4'); is($results[0]->sched_date, '16.11.2011', 'first result: scheduled date ok'); is($results[0]->sched_time, '09:36', 'first result: scheduled time ok'); is($results[0]->platform, '#1', 'first result: platform ok'); is($results[0]->platform, '1', 'first result: platform ok'); is($results[0]->platform_db, 1, 'first result: platform_db ok'); is($results[3]->destination, decode('UTF-8', 'Mülheim Heißen Kirche'), 'fourth result: destination ok'); is($results[3]->info, decode('UTF-8', 'Ab (H) Heißen Kirche, Umstieg in den SEV Ri. Mülheim Hbf.'), 'fourth result: no info'); Loading @@ -46,6 +47,7 @@ is($results[3]->delay, 0, 'fourth result: delay 0'); is($results[3]->sched_date, '16.11.2011', 'fourth result: scheduled date ok'); is($results[3]->sched_time, '09:39', 'fourth result: scheduled time ok'); is($results[3]->platform, '2', 'fourth result: platform ok'); is($results[3]->platform_db, 0, 'fourth result: platform_db ok'); is($results[-1]->destination, 'Hamm (Westf)', 'last result: destination ok'); is($results[-1]->info, decode('UTF-8', 'Fahrradmitnahme begrenzt möglich'), 'last result: info ok'); Loading @@ -55,4 +57,5 @@ is($results[-1]->date, '16.11.2011', 'last result: date ok'); is($results[-1]->time, '10:05', 'last result: time ok'); is($results[-1]->sched_date, '16.11.2011', 'first result: scheduled date ok'); is($results[-1]->sched_time, '09:53', 'first result: scheduled time ok'); is($results[-1]->platform, '#6', 'last result: platform ok'); is($results[-1]->platform, '6', 'last result: platform ok'); is($results[-1]->platform_db, 1, 'last result: platform ok'); Loading
bin/efa-m +8 −2 Original line number Diff line number Diff line Loading @@ -105,17 +105,23 @@ if ( my $err = $status->errstr ) { for my $d ( $status->results ) { my $platform = $d->platform; if ( $d->platform_db ) { $platform .= ' (DB)'; } if ( ( @grep_lines and not( $d->line ~~ \@grep_lines ) ) or ( @grep_platforms and not( substr( $d->platform, 6 ) ~~ \@grep_platforms ) ) and not( $platform ~~ \@grep_platforms ) ) ) { next; } push( @output, [ $d->time, $d->platform, $d->line, $d->destination, $d->info ] ); [ $d->time, $platform, $d->line, $d->destination, $d->info ] ); } display_result(@output); Loading
lib/Travel/Status/DE/VRR.pm +7 −0 Original line number Diff line number Diff line Loading @@ -187,12 +187,19 @@ sub results { my $countdown = $e->getAttribute('countdown'); my $delay = $e_info->getAttribute('delay') // 0; my $platform_is_db = 0; if ( $platform =~ s{ ^ \# }{}ox ) { $platform_is_db = 1; } push( @results, Travel::Status::DE::VRR::Result->new( date => $rdate, time => $rtime, platform => $platform, platform_db => $platform_is_db, line => $line, destination => decode( 'UTF-8', $dest ), countdown => $countdown, Loading
lib/Travel/Status/DE/VRR/Result.pm +1 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,7 @@ use parent 'Class::Accessor'; our $VERSION = '0.02'; Travel::Status::DE::VRR::Result->mk_ro_accessors( qw(countdown date delay destination info line platform sched_date sched_time time type) qw(countdown date delay destination info line platform platform_db sched_date sched_time time type) ); sub new { Loading
t/20-vrr.t +6 −3 Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ use utf8; use Encode qw(decode); use File::Slurp qw(slurp); use Test::More tests => 111; use Test::More tests => 114; BEGIN { use_ok('Travel::Status::DE::VRR'); Loading Loading @@ -35,7 +35,8 @@ is($results[0]->time, '09:40', 'first result: real time ok'); is($results[0]->delay, 4, 'first result: delay 4'); is($results[0]->sched_date, '16.11.2011', 'first result: scheduled date ok'); is($results[0]->sched_time, '09:36', 'first result: scheduled time ok'); is($results[0]->platform, '#1', 'first result: platform ok'); is($results[0]->platform, '1', 'first result: platform ok'); is($results[0]->platform_db, 1, 'first result: platform_db ok'); is($results[3]->destination, decode('UTF-8', 'Mülheim Heißen Kirche'), 'fourth result: destination ok'); is($results[3]->info, decode('UTF-8', 'Ab (H) Heißen Kirche, Umstieg in den SEV Ri. Mülheim Hbf.'), 'fourth result: no info'); Loading @@ -46,6 +47,7 @@ is($results[3]->delay, 0, 'fourth result: delay 0'); is($results[3]->sched_date, '16.11.2011', 'fourth result: scheduled date ok'); is($results[3]->sched_time, '09:39', 'fourth result: scheduled time ok'); is($results[3]->platform, '2', 'fourth result: platform ok'); is($results[3]->platform_db, 0, 'fourth result: platform_db ok'); is($results[-1]->destination, 'Hamm (Westf)', 'last result: destination ok'); is($results[-1]->info, decode('UTF-8', 'Fahrradmitnahme begrenzt möglich'), 'last result: info ok'); Loading @@ -55,4 +57,5 @@ is($results[-1]->date, '16.11.2011', 'last result: date ok'); is($results[-1]->time, '10:05', 'last result: time ok'); is($results[-1]->sched_date, '16.11.2011', 'first result: scheduled date ok'); is($results[-1]->sched_time, '09:53', 'first result: scheduled time ok'); is($results[-1]->platform, '#6', 'last result: platform ok'); is($results[-1]->platform, '6', 'last result: platform ok'); is($results[-1]->platform_db, 1, 'last result: platform ok');