Created
April 20, 2017 02:17
-
-
Save samcv/51e8a1fd862ad512a7983a1006c176e2 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
use JSON::Fast; | |
use v6.d.PREVIEW; | |
my $lock = Lock.new; | |
my @list; | |
say "getting list"; | |
my $list = qx{curl -s 'https://raw.githubusercontent.com/perl6/ecosystem/master/META.list'}; | |
say "got list"; | |
await do for $list.lines -> $url { | |
start { | |
#say $url; | |
my $proc = run 'curl', '-s', $url, :out; | |
my Str $out = $proc.out.slurp; | |
my $result; | |
try { | |
$result = from-json($out); | |
}; | |
#say $result; | |
$lock.protect({ | |
@list.append($result.keys); | |
#say @list; | |
}) if $proc.exitcode == 0 and $result; | |
print '.'; | |
} | |
} | |
print "\n"; | |
Bag(@list).say; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment