Games::Poker::OPP - Implements the Online Poker Protocol
use Games::Poker::OPP; my $poker = Games::Poker::OPP->new( username => "Perlkibot", password => "sekrit", server => "chinook6.cs.ualberta.ca", port => 55006 ); $poker->connect or die $@;
This class implements the Online Poker Protocol as specified at http://games.cs.ualberta.ca/webgames/poker/bots.html. This implementation uses
IO::Socket::INET to do all the communication, but is designed to be subclassable for, e.g. POE.
my $poker = Games::Poker::OPP->new( username => "Perlkibot", password => "sekrit", server => "chinook6.cs.ualberta.ca", port => 55006, status => \&handle_update, callback => \&decide_strategy );
Prepares a new connection to a poker server. This doesn't actually make the connection yet; use
connect to do that.
You must supply a
callback which will be called when it is your turn to act; you may supply a
status callback which will be called during a game when something happens.
Initiates a connection to the specified server. This is something you'll want to override if you're subclassing this module.
$data to the server.
Tries to retrieve
$len bytes of data from the server.
Again, things you'll override when inheriting.
Sends username/password credentials and joins the game. Returns 0 if the username/password was not accepted.
Once you've signed into the server, the
playgame loop will receive status events from the server, update the internal game status object and call your callbacks.
Games::Poker::TexasHold'em object representing the current state of play - the players involved, the pot, and so on. See Games::Poker::TexasHold'em for more information about how to use this.
See the included poker-client.pl as an example of how to use this module.
Simon Cozens, <firstname.lastname@example.org>
Copyright 2003 by Simon Cozens
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.