diff options
-rwxr-xr-x | bin/aseag-m | 5 | ||||
-rw-r--r-- | lib/Travel/Status/DE/URA.pm | 19 |
2 files changed, 16 insertions, 8 deletions
diff --git a/bin/aseag-m b/bin/aseag-m index 86ed39a..2d06089 100755 --- a/bin/aseag-m +++ b/bin/aseag-m @@ -21,6 +21,7 @@ my $strftime_format = '%H:%M:%S'; my $strfrel_format = '%M min'; my ( %edata, @edata_pre ); my $calculate_routes = 0; +my $developer_mode; my $via; GetOptions( @@ -32,6 +33,7 @@ GetOptions( 'S|strfrel=s' => \$strfrel_format, 'v|via=s' => \$via, 'V|version' => \&show_version, + 'devmode' => \$developer_mode, ) or show_help(1); @@ -56,7 +58,8 @@ for my $efield (@edata_pre) { my ($stop_name) = @ARGV; -my $status = Travel::Status::DE::ASEAG->new; +my $status + = Travel::Status::DE::ASEAG->new( developer_mode => $developer_mode ); sub show_help { my ($code) = @_; diff --git a/lib/Travel/Status/DE/URA.pm b/lib/Travel/Status/DE/URA.pm index 1a11d26..eb1c7de 100644 --- a/lib/Travel/Status/DE/URA.pm +++ b/lib/Travel/Status/DE/URA.pm @@ -32,13 +32,14 @@ sub new { my $self = { datetime => $opt{datetime} // DateTime->now( time_zone => 'Europe/Berlin' ), - ura_base => $opt{ura_base}, - ura_version => $opt{ura_version}, - full_routes => $opt{calculate_routes} // 0, - hide_past => $opt{hide_past} // 1, - stop => $opt{stop}, - via => $opt{via}, - post => { + developer_mode => $opt{developer_mode}, + ura_base => $opt{ura_base}, + ura_version => $opt{ura_version}, + full_routes => $opt{calculate_routes} // 0, + hide_past => $opt{hide_past} // 1, + stop => $opt{stop}, + via => $opt{via}, + post => { ReturnList => 'lineid,linename,directionid,destinationtext,vehicleid,' . 'tripid,estimatedtime,stopid,stoppointname' @@ -66,6 +67,10 @@ sub new { $self->{raw_str} = $response->decoded_content; + if ( $self->{developer_mode} ) { + say $self->{raw_str}; + } + # Fix encoding in case we're running through test files if ( substr( $self->{ura_instant_url}, 0, 5 ) eq 'file:' ) { $self->{raw_str} = encode( 'UTF-8', $self->{raw_str} ); |