Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Using a thread to provide visual feedback.

by marioroy (Vicar)
on Jun 22, 2018 at 15:10 UTC ( #1217207=note: print w/replies, xml ) Need Help??


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;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1217207]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (4)
As of 2019-10-16 04:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?