I've a script which does some long running computations, and updates certain counter variables from time to time.
Ideally I would like to display these values from time to time. So here's what I tried
use Data::Dumper;
use Mojo::IOLoop;
my $loop = Mojo::IOLoop->singleton;
my $counterRef = {COUNTER1 => 0, COUNTER2 =>0,...} ;
$loop->recurring(1, sub { Dumper($counterRef) });
#$loop->start;
# Begin long running computation
$loop->end;
The problem is $loop->start is a blocking call. So I'm stuck, how do I start the loop w/o blocking ?