Nick Kostyria > curl_ev > Net::Curl::Multi::EV

Download:
curl_ev-0.01.4.tar.gz

Annotate this POD

View/Report Bugs
Source  

NAME ^

Net::Curl::Multi::EV - Using Net::Curl::Multi with EV.

SYNOPSIS ^

 use EV;
 use Net::Curl::Multi;
 use Net::Curl::Easy qw(/^CURLOPT_/);
 use Net::Curl::Multi::EV;
 
 my $multi   = Net::Curl::Multi->new();
 my $curl_ev = Net::Curl::Multi::EV::curl_ev($multi);

 my $easy = Net::Curl::Easy->new();
 
 $easy->setopt(CURLOPT_URL, $url);
 # ...
 
 my $finish = sub {
        my ($easy, $result) = @_;
        # ... $resul is Net::Curl::Easy::Code
        # ...
        EV::break();
 };
 
 my $timeout =  4 * 60
 $curl_ev->($easy, $finish, $timeout);
 
 EV::run();

DESCRIPTION ^

Using Net::Curl::Multi with EV.

The module consists of the only curl_ev method, that receives the Net::Curl::Multi object and returns closures-function aimed in Net::Curl::Easy objects registration. When registering an object please define also the callback function and timeout in seconds (optional). The callback function is called when the work with Net::Curl::Easy is finished and accepts two arguments Net::Curl::Easy and Net::Curl::Easy::Code.

See example.pl file.

AUTHOR ^

Nick Kostyria

COPYRIGHT AND LICENSE ^

Copyright (C) 2013 by Nick Kostyria

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.

SEE ALSO ^

EV Net::Curl

syntax highlighting: