Skip to content

Instantly share code, notes, and snippets.

@autarch
Created December 6, 2015 19:58
Show Gist options
  • 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