AnyEvent-Lingr
view release on metacpan or search on metacpan
lib/AnyEvent/Lingr.pm view on Meta::CPAN
password => 'your lingr password',
api_key => 'your lingr api_key', # optional
);
# error handler
$lingr->on_error(sub {
my ($msg) = @_;
warn 'Lingr error: ', $msg;
# reconnect after 5 seconds,
my $t; $t = AnyEvent->timer(
after => 5,
cb => sub {
$lingr->start_session;
undef $t;
},
);
});
# room info handler
$lingr->on_room_info(sub {
lib/AnyEvent/Lingr.pm view on Meta::CPAN
This is http level or connection level error. Otherwise C<$msg> is error message returned from lingr api server.
Both case, lingr session was closed before this callback, so you can restart session in this callback:
$lingr->on_error(sub {
my ($msg) = @_;
warn 'Lingr error: ', $msg;
# reconnect after 5 seconds,
my $t; $t = AnyEvent->timer(
after => 5,
cb => sub {
$lingr->start_session;
undef $t;
},
);
});
=head2 on_room_info->($rooms)
( run in 0.976 second using v1.01-cache-2.11-cpan-49f99fa48dc )