From 444dad0d33aa2d0ca9750bbac49268489854ba4d Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sun, 2 Mar 2014 19:20:31 +0100 Subject: Add option to specify maximum number of connections --- lib/Travel/Routing/DE/EFA.pm | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'lib/Travel/Routing') diff --git a/lib/Travel/Routing/DE/EFA.pm b/lib/Travel/Routing/DE/EFA.pm index 6d67bd8..4047306 100644 --- a/lib/Travel/Routing/DE/EFA.pm +++ b/lib/Travel/Routing/DE/EFA.pm @@ -156,6 +156,14 @@ sub max_interchanges { return; } +sub number_of_trips { + my ( $self, $num ) = @_; + + $self->{post}->{calcNumberOfTrips} = $num; + + return; +} + sub select_interchange_by { my ( $self, $prefer ) = @_; @@ -312,6 +320,7 @@ sub create_post { name_destination => q{}, name_origin => q{}, name_via => q{}, + nextDepsPerLeg => 1, outputFormat => 'XML', placeInfo_destination => 'invalid', placeInfo_origin => 'invalid', @@ -364,6 +373,9 @@ sub create_post { if ( $conf->{max_interchanges} ) { $self->max_interchanges( $conf->{max_interchanges} ); } + if ( $conf->{num_results} ) { + $self->number_of_trips( $conf->{num_results} ); + } if ( $conf->{select_interchange_by} ) { $self->select_interchange_by( $conf->{select_interchange_by} ); } @@ -586,6 +598,8 @@ sub parse_xml { my $tree = $self->{tree} = XML::LibXML->load_xml( string => $self->{xml_reply}, ); + # say $tree->toString(2); + my $xp_element = XML::LibXML::XPathExpression->new( '//itdItinerary/itdRouteList/itdRoute'); my $xp_err = XML::LibXML::XPathExpression->new( @@ -785,6 +799,11 @@ seilbahn, schiff, ast, sonstige Set maximum number of interchanges +=item B => I + +Return up to I connections. If unset, the default of the respective +EFA server is used (usually 4 or 5). + =item B => B|B|B Prefer either fast connections (default), connections with low wait time or -- cgit v1.2.3