> the APR::Socket object is an opaque one, so it can't interoperate with any > other perl modules. Have you looked if there is some C api to get the > native socket object? There could be one (as they have for file objects), > I didn't check.
I looked through apr_network_io.h, which seemed like the logical place, and couldn't find an API that returns the native socket object. But I'm pretty unfamiliar with the Apache code base, so someone else would probably have better luck. > >How much work is it to write the mappings for APR::Poll? I've never > >done it before but.. well we could give it a shot! > > What C functions do you need to be exposed? it should be really quick if > it can be exposed as is, without needing to write a special glue code... The polling interface can poll files or sockets. For our application, all we care about is sockets, but perhaps for completeness the implementation should allow polling of files too. These methods would need to be exposed to Perl: apr_pollset_create -- Create a set of things to poll. apr_pollset_add -- Add something to a set. apr_pollset_remove -- Remove something from a set. apr_pollset_poll -- Poll the set in a particular way. apr_pollset_destroy -- Destroy the set. We would also need to a way of filling in the apr_pollfd_t type (i.e. polling file descriptor): struct apr_pollfd_t { apr_pool_t *p; /**< associated pool */ apr_datatype_e desc_type; /**< descriptor type */ apr_int16_t reqevents; /**< requested events */ apr_int16_t rtnevents; /**< returned events */ apr_descriptor desc; /**< @see apr_descriptor */ void *client_data; /**< allows app to associate context */ }; The desc field is a union that either contains a pointer to a socket or a file (apr_file_t or apr_socket_t -- take your pick). The client_data field is just a handy storage box for arbitrary data you might want to use when you poll your file or socket. And we'd also need this enum exposed as constants: typedef enum { APR_NO_DESC, /**< nothing here */ APR_POLL_SOCKET, /**< descriptor refers to a socket */ APR_POLL_FILE, /**< descriptor refers to a file */ APR_POLL_LASTDESC /**< descriptor is the last one in the list */ } apr_datatype_e ; And of course some other #defines. TTUL Ken -- MailChannels: Control Your Email http://www.mailchannels.com Ken Simpson, CEO +1-604-729-1741 -- Report problems: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html List etiquette: http://perl.apache.org/maillist/email-etiquette.html