Net::AIM::TOC - Perl implementation of the AIM TOC protocol


The Net::AIM::TOC module implements in AIM TOC protocol in such a way which make it simple for using when writing bots or AIM clients in Perl.

All of the code regarding the connection is abstracted in order to simplify the AIM connection down to merely sending and receiving instant messages and toc commands.


  use Error qw( :try );
  use Net::AIM::TOC;

  try {
    my $aim = Net::AIM::TOC->new;
    $aim->sign_on( $screenname, $password );

    my $msgObj = $aim->recv_from_aol;
    print $msgObj->getMsg, "\n";
    $aim->send_im_to_aol( $buddy, $msg );

    exit( 0 );

  catch Net::AIM::TOC::Error with {
    my $err = shift;
    print $err->stringify, "\n";




A Net::AIM::TOC object is created by calling the new constructor without arguments. A reference to the newly created object is returned, however, no connection to AIM has yet been made. One first is required to called connect and sign_on before attempting to send/receive instant messages.

new ()

Returns Net::AIM::TOC object but does not create a connection or sign on to the AIM service.


connect ( ARGS )

The connect method can be called without arguments to connect to the AIM service using the default AIM servers.

Alternatively, a hash containing any of the following keys can be passed in to connect to another service using the TOC protocol:

sign_on ( ARGS )

sign_on is called to sign on to the AIM service. The arguments to be passed in are the screen name and password to be used to sign on to the service.

send_im_to_aol ( ARGS )

Sends an instant message. The first argument should be the name of the receipient buddy and the second argument is the message which you are sending.

send_to_aol ( ARGS )

Sends whatever string is passed in on to the AIM service. Useful for sending toc commands.

recv_from_aol ()

Receives any data sent from the AIM service. This includes all TOC protocol messages (including instant messages), however, PAUSE And SIGN_ON messages are handled internally.

This method returns a Net::AIM::TOC::Messages object. See the documentation for this object is to be used.

disconnect ()

Disconnects from the AIM service.


None, but that does not mean there are not any.




Alistair Francis,