summaryrefslogtreecommitdiff
path: root/lib/Travel/Status
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Travel/Status')
-rw-r--r--lib/Travel/Status/DE/IRIS.pm12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Travel/Status/DE/IRIS.pm b/lib/Travel/Status/DE/IRIS.pm
index eb4ae10..bd2a784 100644
--- a/lib/Travel/Status/DE/IRIS.pm
+++ b/lib/Travel/Status/DE/IRIS.pm
@@ -28,6 +28,7 @@ sub new {
my $self = {
datetime => $opt{datetime}
// DateTime->now( time_zone => 'Europe/Berlin' ),
+ developer_mode => $opt{developer_mode},
iris_base => $opt{iris_base}
// 'http://iris.noncd.db.de/iris-tts/timetable',
lookahead => $opt{lookahead} // ( 4 * 60 ),
@@ -173,7 +174,10 @@ sub get_timetable {
my $res = $ua->get(
$dt->strftime( $self->{iris_base} . "/plan/${eva}/%y%m%d/%H" ) );
- #say 'GET ' . $dt->strftime( $self->{iris_base} . "/plan/${eva}/%y%m%d/%H" );
+ if ( $self->{developer_mode} ) {
+ say 'GET '
+ . $dt->strftime( $self->{iris_base} . "/plan/${eva}/%y%m%d/%H" );
+ }
if ( $res->is_error ) {
$self->{warnstr} = 'Failed to fetch a schedule part: Server returned '
@@ -183,8 +187,6 @@ sub get_timetable {
my $xml = XML::LibXML->load_xml( string => $res->decoded_content );
- #say $xml->toString(1);
-
my $station = ( $xml->findnodes('/timetable') )[0]->getAttribute('station');
for my $s ( $xml->findnodes('/timetable/s') ) {
@@ -201,7 +203,9 @@ sub get_realtime {
my $eva = $self->{nodes}{station}->getAttribute('eva');
my $res = $self->{user_agent}->get( $self->{iris_base} . "/fchg/${eva}" );
- #say 'GET ' . $self->{iris_base} . "/fchg/${eva}";
+ if ( $self->{developer_mode} ) {
+ say 'GET ' . $self->{iris_base} . "/fchg/${eva}";
+ }
if ( $res->is_error ) {
$self->{warnstr} = 'Failed to fetch realtime data: Server returned '