Created
September 5, 2021 14:11
-
-
Save jonathanstowe/7af59860823d65e83fd86c934b3e7412 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Cro::HTTP::Client; | |
my $c; | |
react { | |
whenever Cro::HTTP::Client.get("http://cannibal.local") -> $v { | |
whenever $v.body-text -> $m { | |
$c = $m; | |
done; | |
} | |
} | |
} | |
say $c; | |
# vim: ft=raku |
This file contains hidden or 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 Cro::HTTP::Client; | |
my $c = await (supply { | |
whenever Cro::HTTP::Client.get("http://cannibal.local") -> $v { | |
whenever $v.body-text -> $m { | |
emit $m; | |
done; | |
} | |
} | |
}).Promise; | |
say $c; | |
# vim: ft=raku |
This file contains hidden or 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 Cro::HTTP::Client; | |
my $c = await Cro::HTTP::Client.get("http://cannibal.local").then( { $_.result.body-text }).then({ $_.result.result }); | |
say $c; | |
# vim: ft=raku |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment