# sub ticklist2 {
# 
#     my $self = shift;
# 
#     my $msg = '';
# 
#     my $data = $self->req->json;
# 
#     $self->app->log->debug( 'JSON: '.Dumper($data) );
# 
# #     my $dbh;
# 
#     $msg = scalar(keys %{$data->{data}}) . ' Ids uploaded';
# 
#     my $w;
#     my $h;
# 
#     eval {
# 
#         if ( $self->param('src') eq 'sysnottest' ) {
#             $self->app->log->info('HELLO WORLD');
# use Fcntl;
# 
# sysopen($h, '/tmp/JD', O_NONBLOCK | O_RDONLY);
# 
# #             open(my $h, '+</tmp/JD');
#             $w = Mojo::IOLoop->singleton->reactor->io( $h, sub {
#                 my ( $r, $writable ) = @_;
#                 $self->app->log->info( 'HERE ' . $writable);
#                 if ( ! $writable ) {
#                     my $buf = '';
#                     my $data;
#                     while (1) {
#                         last unless sysread( $h, $buf, 2048, length($buf) );
#                     }
#                     $data  = $buf;
#                     $self->app->log->info( 'DATA ' . $data ) if $data;
#                 }
#             } );
# 
#             Mojo::IOLoop->singleton->reactor->watch( $h, 1, 0 );
# 
#         }
#         else {
#             die "src parameter is missing. Aborted\n";
#         }
#     };
# 
# #     $dbh->disconnect if $dbh;
#     if ( my $err = $@ ) {
#         $self->app->log->error($err);
#         return $self->render( json => { msg => $err }, status => 418 );
#     }
# 
#     $self->render( json => { msg => $msg } );
# 
# } # ticklist2