Net::Curl::Promiser::Select
This module implements Net::Curl::Promiser via Perl’s select() built-in.
See /examples in the distribution for a fleshed-out demonstration.
This is “the hard way” to do this, by the way. Your life will be simpler if you use (or create) an event-loop-based implementation like Net::Curl::Promiser::AnyEvent or Net::Curl::Promiser::IOAsync. See /examples for comparisons.
The following are added in addition to the base class methods:
Returns the bitmasks to use as input to select().
select()
Note that, since these are copies of OBJ’s internal values, you don’t need to copy them again before calling select().
Returns the file descriptors that OBJ tracks—or, in scalar context, the count of such. Useful to check for exception events.
Tell the underlying Net::Curl::Multi object which socket events have happened. $READ_MASK and $WRITE_MASK are as “left” by Perl’s select() built-in.
If, in fact, no events have happened, then this calls socket_action(CURL_SOCKET_TIMEOUT) on the Net::Curl::Multi object (similar to time_out()).
socket_action(CURL_SOCKET_TIMEOUT)
time_out()
Finally, this reaps whatever pending HTTP responses may be ready and resolves or rejects the corresponding Promise objects.
Returns OBJ.
Tell the underlying Net::Curl::Multi object that a timeout happened, and reap whatever pending HTTP responses may be ready.
Calls socket_action(CURL_SOCKET_TIMEOUT) on the underlying Net::Curl::Multi object. The return is the same as that operation returns.
Since process() can also do the work of this function, a call to this function is just an optimization.
process()
This should only be called from event loop logic.
Like libcurl’s curl_multi_timeout(3), but sometimes returns different values depending on the needs of OBJ.
(NB: This value is in seconds, not milliseconds.)
This should only be called (if it’s called at all) from event loop logic.
To install Net::Curl::Promiser, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::Curl::Promiser
CPAN shell
perl -MCPAN -e shell install Net::Curl::Promiser
For more information on module installation, please visit the detailed CPAN module installation guide.