Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@autarch
Created December 6, 2015 19:58
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 autarch/af2ac13e76ec0d487615 to your computer and use it in GitHub Desktop.
Save autarch/af2ac13e76ec0d487615 to your computer and use it in GitHub Desktop.
method !run-with-progress ($items, Routine $sub, Str $msg = q{ done}) {
my $prog = Term::ProgressBar.new( :count( $items.elems ), :p )
if $!verbose;
my $i = 1;
$items.hyper( :batch($!threads) ).map(
sub ($item) {
say $item;return;
$sub($item);
say "THREAD #{$*THREAD.id}";
$prog.?update($i);
$i++;
},
);
$prog.?message($msg);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment