From d621a8c7c6b656c9c0b10d7ce17eb34965eb5dc3 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 25 Jul 2015 02:35:35 +0200 Subject: efa: regroup some code pieces semantically --- bin/efa | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/bin/efa b/bin/efa index 5861a15..466ea61 100755 --- a/bin/efa +++ b/bin/efa @@ -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(); -- cgit v1.2.3