#!/usr/bin/perl # http://perlmonks.org/?node_id=1167900 use Async::Tiny; # http://72.211.166.141:8080/async-tiny.tgz use Curses; use strict; use warnings; my $t = Async::Tiny->new; $t->addReadCallback( *STDIN, sub { die } ); $t->changeReadMode( *STDIN, 'character' ); $t->addRepeatCallback( 0.100, \&counter, 5, [0] ); $t->addRepeatCallback( 0.110, \&counter, 15, [1000] ); sub counter { my ($pos, $statearrayref) = @_; move $pos, 5; addstr ++$statearrayref->[0]; refresh; } initscr(); clear; curs_set 0; box( ACS_VLINE, ACS_HLINE ); eval { $t->eventloop }; endwin();