For Programmers: Free Programming Magazines  


Home > Archive > PERL Modules > March 2006 > Net::OSCAR and do_one_loop question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Net::OSCAR and do_one_loop question
Poker Man

2006-03-30, 6:57 pm

Curious 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 ".";
}

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com