Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by marioroy (Prior)
on Jun 22, 2018 at 15:10 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1217207]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-26 00:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found