Commit 89d0040c authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

cleanup

parent 107ca442
Loading
Loading
Loading
Loading
+7 −12
Original line number Diff line number Diff line
@@ -198,9 +198,7 @@ for my $i ( 0 .. $#routes ) {
		print '# ' . $route->duration;
		if ( $route->ticket_type ) {
			printf( ", class %s (%s€ / %s€)\n\n",
				$route->ticket_type,
				$route->fare_adult, $route->fare_child,
			);
				$route->ticket_type, $route->fare_adult, $route->fare_child, );
		}
		else {
			print "\n\n";
@@ -218,12 +216,9 @@ for my $i ( 0 .. $#routes ) {

		printf(
			"%-5s ab  %-30s %-20s %s\n%-5s an  %s\n\n",
			$c->departure_time,
			$c->departure_stop_and_platform,
			$c->train_line,
			$c->train_destination,
			$c->arrival_time,
			$c->arrival_stop_and_platform,
			$c->departure_time, $c->departure_stop_and_platform,
			$c->train_line,     $c->train_destination,
			$c->arrival_time,   $c->arrival_stop_and_platform,
		);
	}
	if ( $i != $#routes ) {
+70 −55
Original line number Diff line number Diff line
@@ -418,31 +418,40 @@ sub submit {
sub itddate_str {
	my ( $self, $node ) = @_;

	return sprintf('%02d.%02d.%04d', $node->getAttribute('day'),
	$node->getAttribute('month'), $node->getAttribute('year'));
	return sprintf( '%02d.%02d.%04d',
		$node->getAttribute('day'),
		$node->getAttribute('month'),
		$node->getAttribute('year') );
}

sub itdtime_str {
	my ( $self, $node ) = @_;

	return sprintf('%02d:%02d', $node->getAttribute('hour'),
	return sprintf( '%02d:%02d',
		$node->getAttribute('hour'),
		$node->getAttribute('minute') );
}

sub parse_part {
	my ( $self, $route ) = @_;

	my $xp_route = XML::LibXML::XPathExpression->new('./itdPartialRouteList/itdPartialRoute');
	my $xp_dep = XML::LibXML::XPathExpression->new('./itdPoint[@usage="departure"]');
	my $xp_arr = XML::LibXML::XPathExpression->new('./itdPoint[@usage="arrival"]');
	my $xp_route = XML::LibXML::XPathExpression->new(
		'./itdPartialRouteList/itdPartialRoute');
	my $xp_dep
	  = XML::LibXML::XPathExpression->new('./itdPoint[@usage="departure"]');
	my $xp_arr
	  = XML::LibXML::XPathExpression->new('./itdPoint[@usage="arrival"]');
	my $xp_date = XML::LibXML::XPathExpression->new('./itdDateTime/itdDate');
	my $xp_time = XML::LibXML::XPathExpression->new('./itdDateTime/itdTime');

#	my $xp_tdate = XML::LibXML::XPathExpression->new('./itdDateTimeTarget/itdDate');
#	my $xp_ttime = XML::LibXML::XPathExpression->new('./itdDateTimeTarget/itdTime');
	my $xp_mot = XML::LibXML::XPathExpression->new('./itdMeansOfTransport');
	my $xp_info  = XML::LibXML::XPathExpression->new('./itdInfoTextList/infoTextListElem');
	my $xp_info
	  = XML::LibXML::XPathExpression->new('./itdInfoTextList/infoTextListElem');

	my $xp_fare  = XML::LibXML::XPathExpression->new('./itdFare/itdSingleTicket');
	my $xp_fare
	  = XML::LibXML::XPathExpression->new('./itdFare/itdSingleTicket');

	my @route_parts;

@@ -493,7 +502,10 @@ sub parse_part {
		push( @route_parts, $hash );
	}

	push(@{$self->{routes}}, Travel::Routing::DE::VRR::Route->new($info, @route_parts));
	push(
		@{ $self->{routes} },
		Travel::Routing::DE::VRR::Route->new( $info, @route_parts )
	);

	return;
}
@@ -504,7 +516,8 @@ sub parse {
	my $tree = $self->{tree}
	  = XML::LibXML->load_xml( string => $self->{xml_reply}, );

	my $xp_element = XML::LibXML::XPathExpression->new('//itdItinerary/itdRouteList/itdRoute');
	my $xp_element = XML::LibXML::XPathExpression->new(
		'//itdItinerary/itdRouteList/itdRoute');
	my $xp_odv = XML::LibXML::XPathExpression->new('//itdOdv');

	for my $odv ( $tree->findnodes($xp_odv) ) {
@@ -545,14 +558,16 @@ sub check_ambiguous {
	if ( $s_place eq 'list' ) {
		Travel::Routing::DE::VRR::Exception::Ambiguous->throw(
			post_key      => 'place',
			possibilities => join( q{ | }, map { decode('UTF-8', $_->textContent ) }
			possibilities => join( q{ | },
				map { decode( 'UTF-8', $_->textContent ) }
				  @{ $e_place->findnodes($xp_place_elem) } )
		);
	}
	if ( $s_name eq 'list' ) {
		Travel::Routing::DE::VRR::Exception::Ambiguous->throw(
			post_key      => 'name',
			possibilities => join( q{ | }, map { decode('UTF-8', $_->textContent ) }
			possibilities => join( q{ | },
				map { decode( 'UTF-8', $_->textContent ) }
				  @{ $e_name->findnodes($xp_name_elem) } )
		);
	}
+1 −2
Original line number Diff line number Diff line
@@ -11,8 +11,7 @@ use Travel::Routing::DE::VRR::Route::Part;
our $VERSION = '1.06';

Travel::Routing::DE::VRR::Route->mk_ro_accessors(
	qw(duration ticket_text ticket_type fare_adult fare_child vehicle_time)
);
	qw(duration ticket_text ticket_type fare_adult fare_child vehicle_time));

sub new {
	my ( $obj, $info, @parts ) = @_;