First, like all non-standard Perl modules, you will need to install Net::OSCAR from CPAN, and then you can include it at the top of your Perl programs with the use statement:
use Net::OSCAR qw(:standard);
You can then use the module to create and activate a new bot:
my $aimbot = Net::OSCAR->new(capabilities => [qw(extended_status typing_status)]);
$aimbot->signon(SCREEN_NAME, PASSWORD);
The real power of the module is in it's capability to create callback subroutines that run on a specific action. For instance, let's say I want my bot to respond with the text 'hello there' every time it receives a message from someone else. First, I'll need to set a callback function for the on_im action.
$aim->set_callback_im_in (\&say_hello);
Then, later in the script, we define the say_hello function that is called on every reception of an instant message.
sub on_im {
my ($aim, $sender, $message, $away) = @_;
$aim->send_im($sender, 'hello there');
}
Module Links:
