summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-07-26 16:35:46 +0200
committerDaniel Friesel <derf@finalrewind.org>2014-07-26 16:35:46 +0200
commit1574bc0c80918234921a4963624343b33fcc8d31 (patch)
tree86d04be9f634c57e0b8c652a8c3a0c660d7e4f3a
parent663e5f1ecd0dd37c2b02f04d9d1024a6c6885695 (diff)
fix exclude / --exclude bug
-rw-r--r--Changelog1
-rwxr-xr-xbin/efa4
-rw-r--r--lib/Travel/Routing/DE/EFA.pm14
3 files changed, 14 insertions, 5 deletions
diff --git a/Changelog b/Changelog
index e2b35a8..183a8e5 100644
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,7 @@ git HEAD
* Route::Part: Add {arrival,departure}_{route,station}maps accessors
* efa: Add -m, --maps option
+ * Fix exclude / --exclude (didn't work at all previously)
Travel::Routing::DE::VRR 2.05 - Mon Mar 03 2014
diff --git a/bin/efa b/bin/efa
index f63c9d2..0d35fbc 100755
--- a/bin/efa
+++ b/bin/efa
@@ -216,6 +216,10 @@ if ( defined $opt->{'ignore-info'} and length( $opt->{'ignore-info'} ) == 0 ) {
$opt->{'ignore-info'} = undef;
}
+if ( $opt->{exclude} ) {
+ $opt->{exclude} = [ split( /,/, join( ',', @{ $opt->{exclude} } ) ) ];
+}
+
$efa = eval {
Travel::Routing::DE::EFA->new(
efa_url => $efa_url,
diff --git a/lib/Travel/Routing/DE/EFA.pm b/lib/Travel/Routing/DE/EFA.pm
index c6ac3d9..dfed345 100644
--- a/lib/Travel/Routing/DE/EFA.pm
+++ b/lib/Travel/Routing/DE/EFA.pm
@@ -132,7 +132,7 @@ sub exclude {
my $ok = 0;
for my $map_id ( 0 .. $#mapping ) {
if ( $exclude_type eq $mapping[$map_id] ) {
- $self->{post}->{"inclMOT_${map_id}"} = undef;
+ delete $self->{post}->{"inclMOT_${map_id}"};
$ok = 1;
}
}
@@ -432,7 +432,9 @@ sub new_from_xml {
my $self = { xml_reply => $opt{xml} };
- $self->{config} = { efa_url => $opt{efa_url}, };
+ $self->{config} = {
+ efa_url => $opt{efa_url},
+ };
$self->{config}->{efa_url} =~ m{
(?<netroot> (?<root> [^:]+ : // [^/]+ ) / [^/]+ / )
@@ -459,7 +461,8 @@ sub submit {
if ( $response->is_error ) {
Travel::Routing::DE::EFA::Exception::Net->throw(
- http_response => $response, );
+ http_response => $response,
+ );
}
$self->{xml_reply} = $response->decoded_content;
@@ -638,8 +641,9 @@ sub parse_xml_part {
sub parse_xml {
my ($self) = @_;
- my $tree = $self->{tree}
- = XML::LibXML->load_xml( string => $self->{xml_reply}, );
+ my $tree = $self->{tree} = XML::LibXML->load_xml(
+ string => $self->{xml_reply},
+ );
#say $tree->toString(2);