Skip to content

Instantly share code, notes, and snippets.

@saltlakeryan
Created November 10, 2021 16:36
Show Gist options
  • Save saltlakeryan/9d9b56c269a4d5abe0d7dba4419d37b4 to your computer and use it in GitHub Desktop.
Save saltlakeryan/9d9b56c269a4d5abe0d7dba4419d37b4 to your computer and use it in GitHub Desktop.
Whirley gig progress indicator for perl
#!/usr/bin/perl
# Based on this: https://www.perlmonks.org/?node_id=113661
use strict;
use Time::HiRes qw( sleep );
#$|=1;
our $WHIRLEY_COUNT=-1;
#our @WHIRLEY=('-', '\\', '|', '/');
#our @WHIRLEY=('⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏');
our @WHIRLEY=('▁', '▂', '▃', '▄', '▅', '▆', '▇', '█', '▇', '▆', '▅', '▄', '▃');
sub whirley {
our $WHIRLEY_COUNT;
our $WHIRLEY;
$WHIRLEY_COUNT = ($WHIRLEY_COUNT + 1) % @WHIRLEY;
return @WHIRLEY[$WHIRLEY_COUNT];
}
print STDERR "please wait : ";
while (1) {
sleep 0.3;
print STDERR "\b\b\b " . whirley() . " ";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment