diff options
author | Daniel Friesel <derf@finalrewind.org> | 2015-07-25 02:35:35 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2015-07-25 02:35:35 +0200 |
commit | d621a8c7c6b656c9c0b10d7ce17eb34965eb5dc3 (patch) | |
tree | 586f305548970227a23757012e70054c50056df5 | |
parent | 79a9e0eeb7d4d2adbb3e466b497888a5cc2795c0 (diff) |
efa: regroup some code pieces semantically
-rwxr-xr-x | bin/efa | 39 |
1 files changed, 19 insertions, 20 deletions
@@ -283,6 +283,10 @@ else { $opt->{accessibility} = []; } +if ( $opt->{exclude} ) { + @{ $opt->{exclude} } = split( qr{,}, join( q{,}, @{ $opt->{exclude} } ) ); +} + for my $field ( @{ $opt->{accessibility} } ) { given ($field) { when ( [qw[s no-stairs]] ) { $opt->{without_solid_stairs} = 1 } @@ -309,18 +313,6 @@ if ( $opt->{arrive} and $opt->{depart} ) { delete $opt->{arrive}; } -if ( not( @from and @to ) ) { - if ( @ARGV == 4 ) { - ( @from[ 0, 1 ], @to[ 0, 1 ] ) = @ARGV; - } - elsif ( @ARGV == 6 ) { - ( @from[ 0, 1 ], @via[ 0, 1 ], @to[ 0, 1 ] ) = @ARGV; - } - else { - show_help(1); - } -} - if ( not defined $ignore_info ) { $ignore_info = join( q{|}, @@ -333,6 +325,21 @@ if ( not defined $ignore_info ) { ) ); } +elsif ( defined $ignore_info and length($ignore_info) == 0 ) { + $ignore_info = undef; +} + +if ( not( @from and @to ) ) { + if ( @ARGV == 4 ) { + ( @from[ 0, 1 ], @to[ 0, 1 ] ) = @ARGV; + } + elsif ( @ARGV == 6 ) { + ( @from[ 0, 1 ], @via[ 0, 1 ], @to[ 0, 1 ] ) = @ARGV; + } + else { + show_help(1); + } +} for my $pair ( [ \@from, \$from_type ], [ \@via, \$via_type ], [ \@to, \$to_type ], ) @@ -352,14 +359,6 @@ for my $pair ( [ \@from, \$from_type ], [ \@via, \$via_type ], } } -if ( defined $opt->{'ignore-info'} and length( $opt->{'ignore-info'} ) == 0 ) { - $opt->{'ignore-info'} = undef; -} - -if ( $opt->{exclude} ) { - $opt->{exclude} = [ split( qr{,}, join( q{,}, @{ $opt->{exclude} } ) ) ]; -} - if ( $opt->{service} ) { my $service = first { lc( $_->{shortname} ) eq lc( $opt->{service} ) } Travel::Routing::DE::EFA::get_efa_urls(); |