Created
December 6, 2015 19:58
-
-
Save autarch/af2ac13e76ec0d487615 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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