
POE::Component::OSCAR - A POE Component for the Net::OSCAR module

use POE qw(Component::OSCAR);
[ ... POE set up ... ]
sub _start { # start an OSCAR session $oscar = POE::Component::OSCAR->new();
# set up the "im_in" callback to call your state, "im_in_state"
$oscar->set_callback( im_in => 'im_in_state');
# sign on
$oscar->signon( screenname => $MY_SCREENNAME, password => $MY_PASSWORD );
}
sub im_in_state { my ($nothing, $args) = @_[ARG0..$#_]; my ($object, $who, $what, $away) = @$args;
print "Got '$what' from $who\n"; }

This modules requires Net::OSCAR and POE.

This module is a wrapper around the Net::OSCAR module that allows it to be used from POE applications.

The wrapper is very thin, so most of the useful documentation can be found in the Net::OSCAR module.
Create a new connection with
$oscar = POE::Component::OSCAR->new();
Though it has an object interface to make coding simpler, this actually spawns a POE session. The arguments to the object are passed directly to the Net::OSCAR module.
Furthermore, all other method calls on the object are passed directly to the Net::OSCAR module. For instance, to set the debug logging level, use
$oscar->loglevel( 5 );
The only relevant POE::Component::OSCAR method is 'set_callback' which can be used to post events to your own session via Net::OSCAR's callbacks.
For instance, to be notified of an incoming message, use
$oscar->set_callback( im_in => 'im_in_state' );
where 'im_in' is a Net::OSCAR callback (see the Net::OSCAR documentation and the oscartest script for all the callbacks) and 'im_in_state' is a state in your POE session.

The sample_im.pl program included with this package.
The Net::OSCAR documentation.
The oscartest script, which comes with Net::OSCAR

Dan McCormick, <dan@codeop.com>

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