http://www.perlmonks.org?node_id=1217207


in reply to Re: Using a thread to provide visual feedback.
in thread Using a thread to provide visual feedback.

For folks using Perl not built to support threads and wanting to try BrowserUk's example, here is the same thing using MCE::Hobo and MCE::Shared.

#! perl -slw use strict; use MCE::Hobo; use MCE::Shared; sub nap { select '','','', $_[0] } tie my $done, 'MCE::Shared', 0; my $hobo = mce_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 10; $done = 1; $hobo->join;