Re: async IO and gtk



On Sun, 2004-11-07 at 01:15, Eric Mangold wrote:
Hello!

First, I'm very new to perl at the moment. I'm using it to write a Gaim  
plugin.

I would like to know the correct way to use asyncronous sockets with  
gtk-perl.
 From my reading of the docs it appears that GIOChannel's are used to handle
sockets, but they are not wrapped by gtk-perl.

sure they are:

 integer = Glib::IO->add_watch ($fd, $condition, $callback,
        $data=undef, $priority=G_PRIORITY_DEFAULT)

it's documented in the Glib::MainLoop man/perldoc page.

Is there a way to create a socket with perl and have gtk do the  
select()-ing on
it and call my code when interesting things happen?

$socket->fileno should give you the fd you need to pass to add watch.
you may have to "use Socket" for that to work, i can't remember.

-- 
-rm
http://www.neces.com/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]