WebService::Lingr - Low-level Lingr Chat API
use WebService::Lingr; # create a session using your API key my $lingr = WebService::Lingr->new(api_key => "YOUR_API_KEY"); # enter the room 'MyFavoriteRoom' with nick 'api-dude' my $res = $lingr->call('room.enter', { id => 'MyFavoriteRoom', nickname => 'api-dude' }); my $ticket = $res->{ticket}; my $counter = $res->{counter}; # say "Hello world!" my $res = $lingr->call('room.say', { message => 'hello world', ticket => $ticket }); # room.observe blocks while (1) { my $res = $lingr->call('room.observe', { ticket => $ticket, counter => $counter }); for my $message (@{$res->{messages}}) { print "$message->{nick} says: $message->{content}\n"; } } # room.getMessages doesn't, but you can call this method at most once per minute while (1) { my $res = $lingr->call('room.getMessages', { ticket => $ticket, counter => $counter }); # do something ... sleep 60; }
WebService::Lingr is a low-level Lingr API implementation in Perl. By "low-level" it means that this module just gives you a straight mapping of Perl object methods to Lingr REST API, session management and data mapping via JSON.
For higher level event driven programming, you might want to use POE::Component::Client::Lingr (unfinished).
Tatsuhiko Miyagawa <miyagawa@bulknews.net>
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
http://wiki.lingr.com/dev/show/HomePage
To install WebService::Lingr, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WebService::Lingr
CPAN shell
perl -MCPAN -e shell install WebService::Lingr
For more information on module installation, please visit the detailed CPAN module installation guide.