Skip to content

Commit

Permalink
Switch dev Raku HTTP lib
Browse files Browse the repository at this point in the history
  • Loading branch information
JRaspass committed Jan 26, 2021
1 parent 527d574 commit ac6ecd7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion META6.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"name": "Code Golf",
"depends": [
"Cro::HTTP::Client",
"HTTP::Tiny",
"IO::Socket::SSL",
"git://gitlab.com/JRaspass/toml-thumb.git"
]
}
6 changes: 3 additions & 3 deletions latest-langs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env perl6

use Cro::HTTP::Client;
use HTTP::Tiny;
use TOML::Thumb;

constant @urls = (
Expand Down Expand Up @@ -33,10 +33,10 @@ constant @urls = (
my %langs = from-toml slurp 'langs.toml';

for @urls -> (:key($lang), :value($path)) {
state $client = Cro::HTTP::Client.new: :http<1.1>;
state $ua = HTTP::Tiny.new :throw-exceptions;

my $old = %langs{$lang}<version> ~~ / <[\d.]>+ \d+ /;
my $new = (await (await $client.get: "https://en.wikipedia.org/wiki/$path").body)
my $new = $ua.get("https://en.wikipedia.org/wiki/$path")<content>.decode
~~ / < Stable Preview > ' release' .+? '>' ( '#' \d+ ' "' )? <(<[\d.]>+)> /;

printf " %*s %s%s\n", INIT { @urls».key».chars.max }, $lang, $old, $new
Expand Down

0 comments on commit ac6ecd7

Please sign in to comment.