in reply to Re: Re: Re: CGI Net::AIM get_info()
in thread CGI Net::AIM get_info()

I tried that, but even 25 commands later, the socket still read "1":
$aim->get_info("screenname"); $result = $aim->do_one_loop(); $count = 0; while($result eq "1" && $count <25) { $result = $aim->do_one_loop(); $count++; }

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: CGI Net::AIM get_info()
by Roger (Parson) on Jan 16, 2004 at 14:22 UTC
    Ok, I spent some time to study the source of Net::AIM, and got a few clues to how the module(s) work.

    Net::AIM has an event driven model. You need to set up handlers in your code to handle various events. For this particular exercise I assume that the name of the get_info event is indeed get_info. You will need to find out the exact name of the get_info event, by turning on the debug option in the module.
    ... # set up a handler to handle the 'get_info' event sub get_info_handler { # four arguments are passed into the handler, but we # are only interested in the second argument, the event my $event = $_[1]; # get the event # $event->{'args'} contains the returning messages # do the processing here ... ... } # set a handler for the 'get_info' event $aim->getconn()->set_handler('get_info', \&get_info_handler); $aim->get_info("screenname"); $aim->do_one_loop(); # this will invoke the event handler