Loading bin/efa +24 −15 Original line number Diff line number Diff line Loading @@ -4,8 +4,6 @@ use warnings; use 5.010; use utf8; no if $] >= 5.018, warnings => 'experimental::smartmatch'; use utf8; use Encode qw(decode); Loading Loading @@ -340,14 +338,23 @@ if ( $opt->{exclude} ) { @{ $opt->{exclude} } = split( qr{,}, join( q{,}, @{ $opt->{exclude} } ) ); } my %accessibility_map = ( s => 'without_solid_stairs', 'no-stairs' => 'without_solid_stairs', e => 'without_escalators', 'no-escalators' => 'without_escalators', E => 'without_elevators', 'no-elevators' => 'without_elevators', l => 'with_low_platform', nf => 'with_low_platform', 'low-platform' => 'with_low_platform', w => 'with_wheelchair', wheelchair => 'with_wheelchair', ); for my $field ( @{ $opt->{accessibility} } ) { given ($field) { when ( [qw[s no-stairs]] ) { $opt->{without_solid_stairs} = 1 } when ( [qw[e no-escalators]] ) { $opt->{without_escalators} = 1 } when ( [qw[E no-elevators]] ) { $opt->{without_elevators} = 1 } when ( [qw[l nf low-platform]] ) { $opt->{with_low_platform} = 1 } when ( [qw[w wheelchair]] ) { $opt->{with_wheelchair} = 1 } when ( [qw[i info]] ) { } # used for ignore_info default if ( $accessibility_map{$field} ) { $opt->{ $accessibility_map{$field} } = 1; } } Loading Loading @@ -405,9 +412,11 @@ for my $pair ( [ \@from, \$from_type ], [ \@via, \$via_type ], {$+{target}}x ) { given ( $+{type} ) { when ('addr') { ${ $pair->[1] } = 'address' } default { ${ $pair->[1] } = $+{type} } if ( $+{type} eq 'addr' ) { ${ $pair->[1] } = 'address'; } else { ${ $pair->[1] } = $+{type}; } } } Loading lib/Travel/Routing/DE/EFA.pm +27 −27 Original line number Diff line number Diff line Loading @@ -5,8 +5,6 @@ use warnings; use 5.010; use utf8; no if $] >= 5.018, warnings => "experimental::smartmatch"; use Carp qw(cluck); use Encode qw(encode); use Travel::Routing::DE::EFA::Route; Loading Loading @@ -176,18 +174,20 @@ sub number_of_trips { sub select_interchange_by { my ( $self, $prefer ) = @_; given ($prefer) { when ('speed') { $self->{post}->{routeType} = 'LEASTTIME' } when ('waittime') { $self->{post}->{routeType} = 'LEASTINTERCHANGE' } when ('distance') { $self->{post}->{routeType} = 'LEASTWALKING' } default { if ( $prefer eq 'speed' ) { $self->{post}->{routeType} = 'LEASTTIME' } elsif ( $prefer eq 'waittime' ) { $self->{post}->{routeType} = 'LEASTINTERCHANGE'; } elsif ( $prefer eq 'distance' ) { $self->{post}->{routeType} = 'LEASTWALKING'; } else { Travel::Routing::DE::EFA::Exception::Setup->throw( option => 'select_interchange_by', have => $prefer, want => 'speed / waittime / distance', ); } } return; } Loading @@ -195,18 +195,16 @@ sub select_interchange_by { sub train_type { my ( $self, $include ) = @_; given ($include) { when ('local') { $self->{post}->{lineRestriction} = 403 } when ('ic') { $self->{post}->{lineRestriction} = 401 } when ('ice') { $self->{post}->{lineRestriction} = 400 } default { if ( $include eq 'local' ) { $self->{post}->{lineRestriction} = 403 } elsif ( $include eq 'ic' ) { $self->{post}->{lineRestriction} = 401 } elsif ( $include eq 'ice' ) { $self->{post}->{lineRestriction} = 400 } else { Travel::Routing::DE::EFA::Exception::Setup->throw( option => 'train_type', have => $include, want => 'local / ic / ice', ); } } return; } Loading @@ -229,7 +227,7 @@ sub use_near_stops { sub walk_speed { my ( $self, $walk_speed ) = @_; if ( $walk_speed ~~ [ 'normal', 'fast', 'slow' ] ) { if ( $walk_speed =~ m{ ^ (?: normal | fast | slow ) $ }x ) { $self->{post}->{changeSpeed} = $walk_speed; } else { Loading Loading @@ -305,7 +303,7 @@ sub place { @{ $self->{post} }{ "place_${which}", "name_${which}" } = ( $place, $stop ); if ( $type ~~ [qw[address poi stop]] ) { if ( $type =~ m{ ^ (?: address | poi | stop ) $ }x ) { $self->{post}->{"type_${which}"} = $type; } Loading Loading @@ -728,7 +726,9 @@ sub parse_xml_part { my $name = $ve->getAttribute('name'); my $platform = $ve->getAttribute('platformName'); if ( $name ~~ [ $hash->{departure_stop}, $hash->{arrival_stop} ] ) { if ( $name eq $hash->{departure_stop} or $name eq $hash->{arrival_stop} ) { next; } Loading lib/Travel/Routing/DE/VRR.pm +0 −2 Original line number Diff line number Diff line Loading @@ -4,8 +4,6 @@ use strict; use warnings; use 5.010; no if $] >= 5.018, warnings => "experimental::smartmatch"; our $VERSION = '2.21'; use parent 'Travel::Routing::DE::EFA'; Loading Loading
bin/efa +24 −15 Original line number Diff line number Diff line Loading @@ -4,8 +4,6 @@ use warnings; use 5.010; use utf8; no if $] >= 5.018, warnings => 'experimental::smartmatch'; use utf8; use Encode qw(decode); Loading Loading @@ -340,14 +338,23 @@ if ( $opt->{exclude} ) { @{ $opt->{exclude} } = split( qr{,}, join( q{,}, @{ $opt->{exclude} } ) ); } my %accessibility_map = ( s => 'without_solid_stairs', 'no-stairs' => 'without_solid_stairs', e => 'without_escalators', 'no-escalators' => 'without_escalators', E => 'without_elevators', 'no-elevators' => 'without_elevators', l => 'with_low_platform', nf => 'with_low_platform', 'low-platform' => 'with_low_platform', w => 'with_wheelchair', wheelchair => 'with_wheelchair', ); for my $field ( @{ $opt->{accessibility} } ) { given ($field) { when ( [qw[s no-stairs]] ) { $opt->{without_solid_stairs} = 1 } when ( [qw[e no-escalators]] ) { $opt->{without_escalators} = 1 } when ( [qw[E no-elevators]] ) { $opt->{without_elevators} = 1 } when ( [qw[l nf low-platform]] ) { $opt->{with_low_platform} = 1 } when ( [qw[w wheelchair]] ) { $opt->{with_wheelchair} = 1 } when ( [qw[i info]] ) { } # used for ignore_info default if ( $accessibility_map{$field} ) { $opt->{ $accessibility_map{$field} } = 1; } } Loading Loading @@ -405,9 +412,11 @@ for my $pair ( [ \@from, \$from_type ], [ \@via, \$via_type ], {$+{target}}x ) { given ( $+{type} ) { when ('addr') { ${ $pair->[1] } = 'address' } default { ${ $pair->[1] } = $+{type} } if ( $+{type} eq 'addr' ) { ${ $pair->[1] } = 'address'; } else { ${ $pair->[1] } = $+{type}; } } } Loading
lib/Travel/Routing/DE/EFA.pm +27 −27 Original line number Diff line number Diff line Loading @@ -5,8 +5,6 @@ use warnings; use 5.010; use utf8; no if $] >= 5.018, warnings => "experimental::smartmatch"; use Carp qw(cluck); use Encode qw(encode); use Travel::Routing::DE::EFA::Route; Loading Loading @@ -176,18 +174,20 @@ sub number_of_trips { sub select_interchange_by { my ( $self, $prefer ) = @_; given ($prefer) { when ('speed') { $self->{post}->{routeType} = 'LEASTTIME' } when ('waittime') { $self->{post}->{routeType} = 'LEASTINTERCHANGE' } when ('distance') { $self->{post}->{routeType} = 'LEASTWALKING' } default { if ( $prefer eq 'speed' ) { $self->{post}->{routeType} = 'LEASTTIME' } elsif ( $prefer eq 'waittime' ) { $self->{post}->{routeType} = 'LEASTINTERCHANGE'; } elsif ( $prefer eq 'distance' ) { $self->{post}->{routeType} = 'LEASTWALKING'; } else { Travel::Routing::DE::EFA::Exception::Setup->throw( option => 'select_interchange_by', have => $prefer, want => 'speed / waittime / distance', ); } } return; } Loading @@ -195,18 +195,16 @@ sub select_interchange_by { sub train_type { my ( $self, $include ) = @_; given ($include) { when ('local') { $self->{post}->{lineRestriction} = 403 } when ('ic') { $self->{post}->{lineRestriction} = 401 } when ('ice') { $self->{post}->{lineRestriction} = 400 } default { if ( $include eq 'local' ) { $self->{post}->{lineRestriction} = 403 } elsif ( $include eq 'ic' ) { $self->{post}->{lineRestriction} = 401 } elsif ( $include eq 'ice' ) { $self->{post}->{lineRestriction} = 400 } else { Travel::Routing::DE::EFA::Exception::Setup->throw( option => 'train_type', have => $include, want => 'local / ic / ice', ); } } return; } Loading @@ -229,7 +227,7 @@ sub use_near_stops { sub walk_speed { my ( $self, $walk_speed ) = @_; if ( $walk_speed ~~ [ 'normal', 'fast', 'slow' ] ) { if ( $walk_speed =~ m{ ^ (?: normal | fast | slow ) $ }x ) { $self->{post}->{changeSpeed} = $walk_speed; } else { Loading Loading @@ -305,7 +303,7 @@ sub place { @{ $self->{post} }{ "place_${which}", "name_${which}" } = ( $place, $stop ); if ( $type ~~ [qw[address poi stop]] ) { if ( $type =~ m{ ^ (?: address | poi | stop ) $ }x ) { $self->{post}->{"type_${which}"} = $type; } Loading Loading @@ -728,7 +726,9 @@ sub parse_xml_part { my $name = $ve->getAttribute('name'); my $platform = $ve->getAttribute('platformName'); if ( $name ~~ [ $hash->{departure_stop}, $hash->{arrival_stop} ] ) { if ( $name eq $hash->{departure_stop} or $name eq $hash->{arrival_stop} ) { next; } Loading
lib/Travel/Routing/DE/VRR.pm +0 −2 Original line number Diff line number Diff line Loading @@ -4,8 +4,6 @@ use strict; use warnings; use 5.010; no if $] >= 5.018, warnings => "experimental::smartmatch"; our $VERSION = '2.21'; use parent 'Travel::Routing::DE::EFA'; Loading