Net::OSCAR and do_one_loop question
am 30.03.2006 21:59:09 von Poker ManCurious if anyone here has any experience with Net::OSCAR.
Below is the simple sample code from the docs (minus my actual
screenname and password). What I added in the while(1) loop was a
simple print ".". This was so I could see that I was truly looping
infinitely, and turns out I wasn't.
After a while I never comeback from do_one_loop until there was an
event (such as an incoming IM). Then it would loop a few times, and
back to being stuck in the do_one_loop.
Which is really no good as I need my app to do other things. I also
tried the sample code OSCAR which is included in the download off of
CPAN, it uses IO::Poll. But the same thing happened. After a while it
would not come back, unless there was some type of IM event.
Anyone have any experience with this, or perhaps know where I can ask?
Many thanks.
P.S. For what it's worth, I promise I am not trying to create some
annoying AIM bot. This is really for alert purposes.
#!/usr/bin/perl -w
use strict;
use Net::OSCAR qw(:standard);
sub im_in {
my($oscar, $sender, $message, $is_away) = @_;
print "[AWAY] " if $is_away;
print "$sender: $message\n";
}
my $oscar = Net::OSCAR->new();
$oscar->set_callback_im_in(\&im_in);
$oscar->signon($screenname , $password);
while(1) {
$oscar->do_one_loop();
print ".";
}