summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2015-10-12 13:44:12 +0200
committerDaniel Friesel <derf@finalrewind.org>2015-10-12 13:44:12 +0200
commit5600e3863c9dc8b321e5f580a3e7bbd4c64da892 (patch)
tree0d72731e0ad4f95e6d12bb411af00fa0de799449
parentd64dec80bc37609090b3f1ba3b253da5ed3c9bde (diff)
add devmode option (moar debugging)
-rwxr-xr-xbin/aseag-m5
-rw-r--r--lib/Travel/Status/DE/URA.pm19
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} );