diff options
-rw-r--r-- | bus.pl | 16 | ||||
-rw-r--r-- | forecast-file.pl | 57 | ||||
-rw-r--r-- | lib/TFL/Bus.pm | 2 |
3 files changed, 0 insertions, 75 deletions
@@ -1,16 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use 5.014; -use TFL::Bus; -use Data::Printer; - -my $bus = TFL::Bus->new(); - -my $res = $bus->request(TFL::Bus::Request->new({ - StopPointName => 'Hotspur Road', - #Towards => 'Islip Manor', - ReturnList => [qw(StopID StopCode1 VisitNumber TripID VehicleID LineID LineName DirectionID DestinationText DestinationName EstimatedTime)], -})); - -p $res; diff --git a/forecast-file.pl b/forecast-file.pl deleted file mode 100644 index 02dba1c..0000000 --- a/forecast-file.pl +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; -use 5.014; -use WebService::ForecastIo::Response; -use Path::Class; -use Template::Provider::Encoding; -use Template::Stash::ForceUTF8; -use Template; - -my %icon_for=( - 'clear-day' => '2', - 'clear-night' => '3', - rain => '18', - snow => '23', - sleet => '24', - wind => '6', - fog => '13', - cloudy => '14', - 'partly-cloudy-day' => '8', - 'partly-cloudy-night' => '9', -); - -sub icon_for { - my ($status) = @_; - - return "icons/".($icon_for{$status}//'45').".svg"; -} - -my $res = WebService::ForecastIo::Response->new( - file($ARGV[0])->slurp(iomode=>'<:raw') -); -my $tf = file(__FILE__)->parent->file('forecast.html.tt'); -my $t = Template->new( - LOAD_TEMPLATES => [ Template::Provider::Encoding->new( - ABSOLUTE => 1, - RELATIVE => 1, - ) ], - STASH => Template::Stash::ForceUTF8->new, -); -binmode STDOUT,':utf8'; -$t->process($tf->stringify,{ - f => $res, - icon_for => \&icon_for, -}) - or die $t->error; - -__DATA__ -[% MACRO dtspan BLOCK -%] -<[% x.start_time.strftime('%H:%M%z') %] - [%x.stop_time.strftime('%H:%M%z') %]> [% x.value %] -[%- END -%] -Currently: [% f.currently.summary %] [% f.currently.temperature %]° -[% f.hourly.summary %] - -[% FOREACH x IN f.hourly.spans_by_string('summary'); dtspan(x=x); ' '; END %] -[% FOREACH x IN f.hourly.spans_by_number('temperature',2); dtspan(x=x); ' '; END %] - diff --git a/lib/TFL/Bus.pm b/lib/TFL/Bus.pm index d704f19..820d630 100644 --- a/lib/TFL/Bus.pm +++ b/lib/TFL/Bus.pm @@ -102,8 +102,6 @@ sub request { if ($http_response->is_success) { my $json = $http_response->content; - use Data::Printer;p $json; - return TFL::Bus::Response->new_from_json( $request->ReturnList, $json |