Acme-ProgressBar
view release on metacpan or search on metacpan
lib/Acme/ProgressBar.pm view on Meta::CPAN
#pod progress { while (<>) { $ua->get($_) } };
#pod progress { sleep 5; }
#pod
#pod There is only one function exported by default, C<progress>. This function
#pod takes a coderef as its lone argument. It will execute this code and display a
#pod simple progress bar indicating the time required for ten iterations through the
#pod code.
#pod
#pod =cut
sub progress(&) { ## no critic Prototype
my ($code) = @_;
local $| = 1; ## no critic
_overprint(_message(0,10,undef));
my $begun = Time::HiRes::time;
$code->();
my $total = Time::HiRes::time - $begun;
for (1 .. 9) {
_overprint(_message($_,10,$total));
( run in 0.985 second using v1.01-cache-2.11-cpan-49f99fa48dc )