Created
March 30, 2016 12:48
-
-
Save MadcapJake/cbfd2e083211eb9971528b1e5fab1bed to your computer and use it in GitHub Desktop.
Refresh RT Perl 6 tickets
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 v6; | |
use Net::Curl::NativeCall; | |
constant RTURL = 'https://rt.perl.org/REST/1.0/'; | |
my Hash @tickets; | |
with curl_easy_init() { | |
my Str $body; | |
my $login = "user=perl6bug\@gmail.com\&pass={$*ENV<SIXBUG_RT_PW>}"; | |
curl_easy_setopt($_, CURLOPT_URL, "{RTURL}search/ticket?query=Queue='perl6'"); | |
curl_easy_setopt($_, CURLOPT_COPYPOSTFIELDS, $login); | |
curl_easy_setopt($_, CURLOPT_WRITEDATA, $body); | |
my $res = curl_easy_perform($_); | |
if $res != CURLE_OK { | |
warn sprintf("curl_easy_perform failed: %s\n", curl_easy_strerror($res)) | |
} else { | |
# say $body; | |
@tickets = gather { | |
for ($body.lines[1..*]».split(': ', 2))[1..*] -> @ ($i, $s) { | |
take { id => $i, subject => $s } | |
} | |
} | |
} | |
curl_easy_cleanup($_) | |
} else { warn "curl failed to initialize" } | |
say @tickets; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment