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

Funny you ask that. My origianl version was something like the following (adjust $delay according to the speed of your system)
use Tie::Cycle; my $delay=100; tie my $spinner, 'Tie::Cycle', [map {("\b$_") x $delay} qw(\ | / -)];
which is an approach I prefer to sleeping, as normally you put a spinner in a time sensitive loop so that you know its doing something... Also when ive used this the actual work happening in the loop is complicated (ie slow enough) that the spinner turns at a reasonable speed. In fact from a diagnostic POV its probably better to let it spin freely with no delay at all. That way you can observe the underlying task slow down or speed up (for whatever reason). For example you might use it when reading a file into a hash. When the hash starts having to resize itself you can observe the spinner stop briefly. Or when doing a massive DB update you can see the load on your network and DB server....

Cheers,

--- demerphq
my friends call me, usually because I'm late....