From 2aab03cd0db9854ffc787dc7c2d2c790bc84cc50 Mon Sep 17 00:00:00 2001 From: Matias Linares Date: Sat, 8 Sep 2018 12:47:13 -0300 Subject: Add run example. --- examples/run.p6 | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 examples/run.p6 (limited to 'examples') diff --git a/examples/run.p6 b/examples/run.p6 new file mode 100644 index 0000000..f78df16 --- /dev/null +++ b/examples/run.p6 @@ -0,0 +1,21 @@ +#!/usr/bin/env perl6 +use v6; +use 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; + } +} -- cgit v1.2.3-70-g09d2