The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WebService::Lingr - Low-level Lingr Chat API

SYNOPSIS

  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;
  }

DESCRIPTION

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).

AUTHOR

Tatsuhiko Miyagawa <miyagawa@bulknews.net>

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

http://wiki.lingr.com/dev/show/HomePage