On Wed, Aug 19, 2009 at 11:03, Tony Esposito<[email protected]> wrote:
> Anyone have the code that make the 'clock' show when a Perl program is
> running?
> What I mean by the 'clock' is the command-line movement that sequentially
> does the following (in place):
>
> - \ | / - \ | /
snip
#!/usr/bin/perl
use strict;
use warnings;
my @spinner = qw{ - \ | / - \ | / };
my @throbber = qw{ . o O o };
$| = 1;
print "waiting: ";
while (1) {
my $spinner_frame = shift @spinner;
my $throbber_frame = shift @throbber;
print "$throbber_frame $spinner_frame";
push @spinner, $spinner_frame;
push @throbber, $throbber_frame;
#wait a tenth of a second
select undef, undef, undef, .1;
print "\b\b\b";
}
--
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/