aboutsummaryrefslogtreecommitdiff
path: root/examples/run.raku
diff options
context:
space:
mode:
authorMatias Linares <matiaslina@gmail.com>2020-03-24 19:37:44 -0300
committerMatias Linares <matiaslina@gmail.com>2020-03-24 19:37:44 -0300
commite1abad7a57fd34ffb55c1d57d0b89ee91e55296b (patch)
tree12fe2d7b6d45543cb52f3b0382bc7de4bcc796fc /examples/run.raku
parent2fb9929b3acd2caf6ca0f0cf1e16f0872f7ae667 (diff)
parente50b8fa9e02b19ece80ebeb576051e451d3a7812 (diff)
downloadperl6-matrix-client-e1abad7a57fd34ffb55c1d57d0b89ee91e55296b.tar.gz
Merge branch 'master' into documentation
Diffstat (limited to 'examples/run.raku')
-rw-r--r--examples/run.raku21
1 files changed, 21 insertions, 0 deletions
diff --git a/examples/run.raku b/examples/run.raku
new file mode 100644
index 0000000..af1b188
--- /dev/null
+++ b/examples/run.raku
@@ -0,0 +1,21 @@
+#!/usr/bin/env raku
+use v6;
+use lib <lib>;
+use Matrix::Client;
+
+sub MAIN(Str:D $username, Str:D $password, :$home-server = "https://matrix.deprecated.org") {
+ my Matrix::Client $client .= new: :$home-server;
+ $client.login($username, $password);
+
+ my $sup = $client.run(:sleep<5>);
+
+ signal(SIGINT).tap({
+ say "Bye";
+ $client.logout;
+ exit 0;
+ });
+
+ react whenever $sup -> $ev {
+ say $ev;
+ }
+}