Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Re: Re: Way of the Spinner (repost)

by Anonymous Monk
on Jan 18, 2003 at 03:59 UTC ( #227910=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Way of the Spinner (repost)
in thread Way of the Spinner (repost)

You can use the select() function to do short sleeps. If your system doesn't support a four-argument select(), you can use the Time::HiRes module. For the select function, the last argument reflects the time to sleep. This comes right out of O'Reilly's Perl Cookbook:

while (<>) { select(undef, undef, undef, 0.25); print; }
Using Time::HiRes, we'd write it as:
use Time::HiRes qw(sleep); while (<>) { sleep(0.25); print; }
Funny thing is that I used nearly the same method of making a spinner a while back...and I had the exact same question about slowing it down. Hope this helps!


Comment on Re: Re: Re: Way of the Spinner (repost)
Select or Download Code
Re: Re: Re: Re: Way of the Spinner (repost)
by joeface (Pilgrim) on Jan 18, 2003 at 04:09 UTC
    Oops. I Posted the above about the select() function Anonymously. So if it doesn't work, you now know who to flame :) Joe

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (15)
As of 2015-07-06 21:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (83 votes), past polls