diff options
author | Gianni Ceccarelli <dakkar@thenautilus.net> | 2013-12-03 14:42:07 +0000 |
---|---|---|
committer | Gianni Ceccarelli <dakkar@thenautilus.net> | 2013-12-03 14:42:07 +0000 |
commit | d382955cb3ade340fa9e667ade8db7ddabadd2c0 (patch) | |
tree | 1d33d22447533a9b647fcc51ee0f956e5fb1171a /lib/HomePanel/Render.pm | |
parent | trying to remove leaks (diff) | |
download | HomePanel-d382955cb3ade340fa9e667ade8db7ddabadd2c0.tar.gz HomePanel-d382955cb3ade340fa9e667ade8db7ddabadd2c0.tar.bz2 HomePanel-d382955cb3ade340fa9e667ade8db7ddabadd2c0.zip |
only load the template once
Diffstat (limited to 'lib/HomePanel/Render.pm')
-rw-r--r-- | lib/HomePanel/Render.pm | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/HomePanel/Render.pm b/lib/HomePanel/Render.pm index cc16eb5..fe165e3 100644 --- a/lib/HomePanel/Render.pm +++ b/lib/HomePanel/Render.pm @@ -34,11 +34,6 @@ has template_file => ( required => 1, ); -has [qw(forecast bus tube)] => ( - is => 'ro', - required => 1, -); - { my %icon_for=( 'clear-day' => '2', @@ -60,16 +55,16 @@ sub icon_for { } sub render { - my ($self) = @_; + my ($self,$data) = @_; my $output; $self->template->process( $self->template_file->stringify, { - f => $self->forecast, - b => $self->bus, - t => $self->tube, + f => $data->{forecast}, + b => $data->{bus}, + t => $data->{tube}, icon_for => \&icon_for, now => DateTime->now, format_duration => sub { DateTime::Format::Duration->new(@_) }, |