aboutsummaryrefslogtreecommitdiff
path: root/examples/run.p6
blob: f78df16d318b48f3f6f675ab66d33efe592dc69c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env perl6
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;
    }
}