in reply to Using a thread to provide visual feedback.
Try something like this:
#! perl -slw use strict; use threads; use threads::shared; sub nap { select '','','', $_[0] } my $done:shared = 0; my $thread = async( sub { $|++; until( $done ) { nap( 0.1 ), printf "\r%s\t\t", '.' x $_ for 1 .. 10, reverse +1 .. 10; nap( 0.01 ), printf "\r%s\t\t", '.' x $_ for 1 .. 10, reverse +1 .. 10; nap( 0.8 ); } }, $done ); sleep 60; $done = 1; $thread->join;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using a thread to provide visual feedback.
by marioroy (Prior) on Jun 22, 2018 at 15:10 UTC | |
|
Re^2: Using a thread to provide visual feedback.
by stevieb (Canon) on Jun 22, 2018 at 02:45 UTC |