diff options
author | Daniel Friesel <derf@finalrewind.org> | 2020-09-06 09:22:40 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2020-09-06 09:22:40 +0200 |
commit | 9bdae29a17e9342eb85db11d97935789492e7dc7 (patch) | |
tree | a59809ea476577b217b9352e44623b4eb62fe4aa /lib/DBInfoscreen.pm | |
parent | c8383c697ac9108b195696a5ca371e79d224225f (diff) |
Move HAFAS helpers to a separate helper class
Diffstat (limited to 'lib/DBInfoscreen.pm')
-rw-r--r-- | lib/DBInfoscreen.pm | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/DBInfoscreen.pm b/lib/DBInfoscreen.pm index e7bdf80..700a4c9 100644 --- a/lib/DBInfoscreen.pm +++ b/lib/DBInfoscreen.pm @@ -5,6 +5,7 @@ use Mojo::Base 'Mojolicious'; # License: 2-Clause BSD use Cache::File; +use DBInfoscreen::Helper::HAFAS; use File::Slurp qw(read_file); use JSON; use Travel::Status::DE::HAFAS; @@ -95,6 +96,19 @@ sub startup { ); $self->helper( + hafas => sub { + my ($self) = @_; + state $hafas = DBInfoscreen::Helper::HAFAS->new( + log => $self->app->log, + main_cache => $self->app->cache_iris_main, + realtime_cache => $self->app->cache_iris_rt, + user_agent => $self->ua, + version => $VERSION, + ); + } + ); + + $self->helper( 'handle_no_results' => sub { my ( $self, $backend, $station, $errstr ) = @_; |