Skip to content

Instantly share code, notes, and snippets.

@polettix

polettix/tt1.pl Secret

Created May 9, 2021 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save polettix/81f2f778d34c12379a627610c2df4059 to your computer and use it in GitHub Desktop.
Save polettix/81f2f778d34c12379a627610c2df4059 to your computer and use it in GitHub Desktop.
Term::Twiddle demonstration
#!/usr/bin/env perl
use 5.024;
use warnings;
use experimental qw< postderef signatures >;
no warnings qw< experimental::postderef experimental::signatures >;
use Time::HiRes 'sleep';
use FindBin '$Bin';
use lib "$Bin/local/lib/perl5", "$Bin/lib";
$|++;
use Term::Twiddle;
my $spinner = Term::Twiddle->new;
print 'wait for it... ';
$spinner->start;
system('sleep 5');
$spinner->stop;
say '';
#!/usr/bin/env perl
use 5.024;
use warnings;
use experimental qw< postderef signatures >;
no warnings qw< experimental::postderef experimental::signatures >;
use Time::HiRes 'sleep';
use FindBin '$Bin';
use lib "$Bin/local/lib/perl5", "$Bin/lib";
$|++;
use Term::Twiddle;
my $spinner = Term::Twiddle->new;
$spinner->thingy([
'| |',
'|~ |',
'|~~ |',
'|~~~ |',
'|~~~~ |',
'|~~~~~ |',
'|~~~~~~ |',
'|~~~~~~~ |',
'|~~~~~~~~ |',
'|~~~~~~~~~ |',
'|~~~~~~~~~~ |',
'|~~~~~~~~~~~ |',
'|~~~~~~~~~~~~|',
'| ~~~~~~~~~~~|',
'| ~~~~~~~~~~|',
'| ~~~~~~~~~|',
'| ~~~~~~~~|',
'| ~~~~~~~|',
'| ~~~~~~|',
'| ~~~~~|',
'| ~~~~|',
'| ~~~|',
'| ~~|',
'| ~|',
]);
print 'wait for it... ';
$spinner->start;
system('sleep 7');
$spinner->stop;
say '';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment