IO-EventMux

 view release on metacpan or  search on metacpan

examples/httpclient.pl  view on Meta::CPAN

    my $HTTP_HDR = 
        "GET $document HTTP/1.1\r\n".
        "Host: $host\r\n".
        "User-Agent: Mozilla/5.0 Gecko/20080325 Firefox/2.0.0.13\r\n".
        "Accept: text/xml,application/xml,application/xhtml+xml,".
            "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n".
        "Accept-Language: en-us,en;q=0.5\r\n".
        "Accept-Encoding: gzip,deflate\r\n".
        "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n".
        "Keep-Alive: 300\r\n".
        "Connection: keep-alive\r\n\r\n";
    
    $mux->send($fh, $HTTP_HDR);
}


new-http-recvfile-api.pl  view on Meta::CPAN

    my $HTTP_HDR = 
        "GET $document HTTP/1.1\r\n".
        "Host: $host\r\n".
        "User-Agent: Mozilla/5.0 Gecko/20080325 Firefox/2.0.0.13\r\n".
        "Accept: text/xml,application/xml,application/xhtml+xml,".
            "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5\r\n".
        "Accept-Language: en-us,en;q=0.5\r\n".
        "Accept-Encoding: gzip,deflate\r\n".
        "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7\r\n".
        "Keep-Alive: 300\r\n".
        "Connection: keep-alive\r\n\r\n";
    
    $mux->send($fh, $HTTP_HDR);
}

http_get("www.google.com", "80", "/");

while(1) {
    my $event = $mux->mux(10);
   
    print "$event->{type}\n"; 



( run in 1.660 second using v1.01-cache-2.11-cpan-39bf76dae61 )