Loading Changelog +4 −0 Original line number Diff line number Diff line git HEAD * Fix encoding issues caused by recent API changes Travel::Routing::DE::VRR 2.15 - Sat Mar 04 2017 * Remove support for Vorarlberger Verkehrsverbund (VVV) backend Loading lib/Travel/Routing/DE/EFA.pm +14 −23 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ use 5.010; no if $] >= 5.018, warnings => "experimental::smartmatch"; use Carp qw(cluck); use Encode qw(decode encode); use Encode qw(encode); use Travel::Routing::DE::EFA::Route; use Travel::Routing::DE::EFA::Route::Message; use LWP::UserAgent; Loading Loading @@ -435,7 +435,7 @@ sub create_post { } for my $val ( values %{ $self->{post} } ) { $val = encode( 'ISO-8859-15', $val ); $val = encode( 'UTF-8', $val ); } return; Loading Loading @@ -555,7 +555,6 @@ sub parse_cur_info { raw_content => $e_content->textContent, ); for my $key ( keys %msg ) { $msg{$key} = decode( 'UTF-8', $msg{$key} ); chomp( $msg{$key} ); } return Travel::Routing::DE::EFA::Route::Message->new(%msg); Loading @@ -565,7 +564,7 @@ sub parse_reg_info { my ( $self, $node ) = @_; my %msg = ( summary => decode( 'UTF-8', $node->textContent ), summary => $node->textContent, ); return Travel::Routing::DE::EFA::Route::Message->new(%msg); Loading Loading @@ -686,10 +685,6 @@ sub parse_xml_part { arrival_platform => $e_arr->getAttribute('platformName'), }; for my $key ( keys %{$hash} ) { $hash->{$key} = decode( 'UTF-8', $hash->{$key} ); } if ($e_fp) { # Note that position=IDEST footpaths are coupled with a special Loading Loading @@ -721,7 +716,7 @@ sub parse_xml_part { next; } my $name = decode( 'UTF-8', $ve->getAttribute('name') ); my $name = $ve->getAttribute('name'); my $platform = $ve->getAttribute('platformName'); if ( $name ~~ [ $hash->{departure_stop}, $hash->{arrival_stop} ] ) { Loading Loading @@ -817,24 +812,20 @@ sub check_ambiguous_xml { if ( $s_place eq 'list' ) { Travel::Routing::DE::EFA::Exception::Ambiguous->throw( post_key => 'place', post_value => decode( 'UTF-8', ( $e_place->findnodes($xp_place_input) )[0]->textContent ), post_value => ( $e_place->findnodes($xp_place_input) )[0]->textContent, possibilities => join( q{ | }, map { decode( 'UTF-8', $_->textContent ) } map { $_->textContent } @{ $e_place->findnodes($xp_place_elem) } ) ); } if ( $s_name eq 'list' ) { Travel::Routing::DE::EFA::Exception::Ambiguous->throw( post_key => 'name', post_value => decode( 'UTF-8', ( $e_name->findnodes($xp_name_input) )[0]->textContent ), post_value => ( $e_name->findnodes($xp_name_input) )[0]->textContent, possibilities => join( q{ | }, map { decode( 'UTF-8', $_->textContent ) } @{ $e_name->findnodes($xp_name_elem) } ) map { $_->textContent } @{ $e_name->findnodes($xp_name_elem) } ) ); } Loading t/21-vrr.t +4 −5 Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ use 5.010; use utf8; use Encode qw(decode); use File::Slurp qw(slurp); use Test::More tests => 82; Loading Loading @@ -56,7 +55,7 @@ is_deeply( [ $c0->departure_routemaps ], ['http://efa.vrr.de/vrr/FILELOAD?Filena is_deeply( [ $c0->departure_stationmaps ], [], 'r0,0: departure_stationmaps'); is_deeply( [ $c0->arrival_routemaps ], ['http://efa.vrr.de/vrr/FILELOAD?Filename=dwa_4ED23486D.pdf'], 'r0,0: arrival_routemaps'); is_deeply( [ $c0->arrival_stationmaps ], ['http://efa.vrr.de/download/envmaps/vrr/09289_e_hbf_1.htm'], 'r0,0: arrival_stationmaps'); is( $c0->train_line, decode( 'UTF-8', 'Straßenbahn 107' ), 'r0,0: line' ); is( $c0->train_line, 'Straßenbahn 107', 'r0,0: line' ); is( $c0->train_destination, 'Essen Hanielstr. Schleife', 'r0,0: dest' ); is( $c0->departure_stop, 'Essen Alfredusbad', 'r0,0: dstop' ); is( $c0->departure_platform, 'Bstg. 1', 'r0,0: dplatf' ); Loading Loading @@ -85,7 +84,7 @@ is_deeply( ($c0->via)[0], is( $c1->delay, 3, 'r0,1: delay' ); is_deeply( [ $c1->extra ], [ decode( 'UTF-8', 'Fahrradmitnahme begrenzt möglich' ) ], [ 'Fahrradmitnahme begrenzt möglich' ], 'r0,1: extra' ); is_deeply( [ $c1->departure_routemaps ], ['http://efa.vrr.de/vrr/FILELOAD?Filename=dwa_4ED23486D.pdf'], 'r0,0: departure_routemaps'); Loading @@ -105,11 +104,11 @@ is( $c1->departure_date, '27.11.2011', 'r0,1: drdate' ); is( $c1->departure_sdate, '27.11.2011', 'r0,1: dsdate' ); is( $c1->departure_time, '14:12', 'r0,1: drtime' ); is( $c1->departure_stime, '14:09', 'r0,1: dstime' ); is( $c1->arrival_stop, decode( 'UTF-8', 'Düsseldorf Hbf' ), 'r0,1: astop' ); is( $c1->arrival_stop, 'Düsseldorf Hbf', 'r0,1: astop' ); is( $c1->arrival_platform, 'Gleis 16', 'r0,1: aplatf' ); is( $c1->arrival_stop_and_platform, decode( 'UTF-8', 'Düsseldorf Hbf: Gleis 16' ), 'Düsseldorf Hbf: Gleis 16', 'r0,1: asp' ); is( $c1->arrival_date, '27.11.2011', 'r0,1: ardate' ); Loading Loading
Changelog +4 −0 Original line number Diff line number Diff line git HEAD * Fix encoding issues caused by recent API changes Travel::Routing::DE::VRR 2.15 - Sat Mar 04 2017 * Remove support for Vorarlberger Verkehrsverbund (VVV) backend Loading
lib/Travel/Routing/DE/EFA.pm +14 −23 Original line number Diff line number Diff line Loading @@ -7,7 +7,7 @@ use 5.010; no if $] >= 5.018, warnings => "experimental::smartmatch"; use Carp qw(cluck); use Encode qw(decode encode); use Encode qw(encode); use Travel::Routing::DE::EFA::Route; use Travel::Routing::DE::EFA::Route::Message; use LWP::UserAgent; Loading Loading @@ -435,7 +435,7 @@ sub create_post { } for my $val ( values %{ $self->{post} } ) { $val = encode( 'ISO-8859-15', $val ); $val = encode( 'UTF-8', $val ); } return; Loading Loading @@ -555,7 +555,6 @@ sub parse_cur_info { raw_content => $e_content->textContent, ); for my $key ( keys %msg ) { $msg{$key} = decode( 'UTF-8', $msg{$key} ); chomp( $msg{$key} ); } return Travel::Routing::DE::EFA::Route::Message->new(%msg); Loading @@ -565,7 +564,7 @@ sub parse_reg_info { my ( $self, $node ) = @_; my %msg = ( summary => decode( 'UTF-8', $node->textContent ), summary => $node->textContent, ); return Travel::Routing::DE::EFA::Route::Message->new(%msg); Loading Loading @@ -686,10 +685,6 @@ sub parse_xml_part { arrival_platform => $e_arr->getAttribute('platformName'), }; for my $key ( keys %{$hash} ) { $hash->{$key} = decode( 'UTF-8', $hash->{$key} ); } if ($e_fp) { # Note that position=IDEST footpaths are coupled with a special Loading Loading @@ -721,7 +716,7 @@ sub parse_xml_part { next; } my $name = decode( 'UTF-8', $ve->getAttribute('name') ); my $name = $ve->getAttribute('name'); my $platform = $ve->getAttribute('platformName'); if ( $name ~~ [ $hash->{departure_stop}, $hash->{arrival_stop} ] ) { Loading Loading @@ -817,24 +812,20 @@ sub check_ambiguous_xml { if ( $s_place eq 'list' ) { Travel::Routing::DE::EFA::Exception::Ambiguous->throw( post_key => 'place', post_value => decode( 'UTF-8', ( $e_place->findnodes($xp_place_input) )[0]->textContent ), post_value => ( $e_place->findnodes($xp_place_input) )[0]->textContent, possibilities => join( q{ | }, map { decode( 'UTF-8', $_->textContent ) } map { $_->textContent } @{ $e_place->findnodes($xp_place_elem) } ) ); } if ( $s_name eq 'list' ) { Travel::Routing::DE::EFA::Exception::Ambiguous->throw( post_key => 'name', post_value => decode( 'UTF-8', ( $e_name->findnodes($xp_name_input) )[0]->textContent ), post_value => ( $e_name->findnodes($xp_name_input) )[0]->textContent, possibilities => join( q{ | }, map { decode( 'UTF-8', $_->textContent ) } @{ $e_name->findnodes($xp_name_elem) } ) map { $_->textContent } @{ $e_name->findnodes($xp_name_elem) } ) ); } Loading
t/21-vrr.t +4 −5 Original line number Diff line number Diff line Loading @@ -5,7 +5,6 @@ use 5.010; use utf8; use Encode qw(decode); use File::Slurp qw(slurp); use Test::More tests => 82; Loading Loading @@ -56,7 +55,7 @@ is_deeply( [ $c0->departure_routemaps ], ['http://efa.vrr.de/vrr/FILELOAD?Filena is_deeply( [ $c0->departure_stationmaps ], [], 'r0,0: departure_stationmaps'); is_deeply( [ $c0->arrival_routemaps ], ['http://efa.vrr.de/vrr/FILELOAD?Filename=dwa_4ED23486D.pdf'], 'r0,0: arrival_routemaps'); is_deeply( [ $c0->arrival_stationmaps ], ['http://efa.vrr.de/download/envmaps/vrr/09289_e_hbf_1.htm'], 'r0,0: arrival_stationmaps'); is( $c0->train_line, decode( 'UTF-8', 'Straßenbahn 107' ), 'r0,0: line' ); is( $c0->train_line, 'Straßenbahn 107', 'r0,0: line' ); is( $c0->train_destination, 'Essen Hanielstr. Schleife', 'r0,0: dest' ); is( $c0->departure_stop, 'Essen Alfredusbad', 'r0,0: dstop' ); is( $c0->departure_platform, 'Bstg. 1', 'r0,0: dplatf' ); Loading Loading @@ -85,7 +84,7 @@ is_deeply( ($c0->via)[0], is( $c1->delay, 3, 'r0,1: delay' ); is_deeply( [ $c1->extra ], [ decode( 'UTF-8', 'Fahrradmitnahme begrenzt möglich' ) ], [ 'Fahrradmitnahme begrenzt möglich' ], 'r0,1: extra' ); is_deeply( [ $c1->departure_routemaps ], ['http://efa.vrr.de/vrr/FILELOAD?Filename=dwa_4ED23486D.pdf'], 'r0,0: departure_routemaps'); Loading @@ -105,11 +104,11 @@ is( $c1->departure_date, '27.11.2011', 'r0,1: drdate' ); is( $c1->departure_sdate, '27.11.2011', 'r0,1: dsdate' ); is( $c1->departure_time, '14:12', 'r0,1: drtime' ); is( $c1->departure_stime, '14:09', 'r0,1: dstime' ); is( $c1->arrival_stop, decode( 'UTF-8', 'Düsseldorf Hbf' ), 'r0,1: astop' ); is( $c1->arrival_stop, 'Düsseldorf Hbf', 'r0,1: astop' ); is( $c1->arrival_platform, 'Gleis 16', 'r0,1: aplatf' ); is( $c1->arrival_stop_and_platform, decode( 'UTF-8', 'Düsseldorf Hbf: Gleis 16' ), 'Düsseldorf Hbf: Gleis 16', 'r0,1: asp' ); is( $c1->arrival_date, '27.11.2011', 'r0,1: ardate' ); Loading