AnyEvent-Lingr
view release on metacpan or search on metacpan
lib/AnyEvent/Lingr.pm view on Meta::CPAN
If you want response data, you can speficy callback.
The callback is invoked when the API call was successful.
$lingr->say('perl_jp', 'hi there!', sub {
my $res = shift;
warn $res->{message}->{id};
});
=head1 CALLBACKS
This module supports following three callbacks:
=over
=item * on_error->($msg)
=item * on_room_info->($rooms)
=item * on_event->($event)
=back
All callbacks can be set by accessor:
$lingr->on_error(sub { ... });
Or by constructor:
my $lingr = AnyEvent::Lingr->new(
...
on_error => sub { ... },
);
=head2 on_error->($msg)
Error callbacks.
C<$msg> is error message. If this message is form of "\d\d\d: message" like:
595: Invalid argument
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 {
( run in 1.151 second using v1.01-cache-2.11-cpan-d6f9594c0a5 )