Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>
WEEK'S BEST
  • Linux Kernel 3.9.6 / 3....
  • Linux Kernel 3.0.82 LTS...
  • KDE Software Compilatio...
  • PulseAudio 4.0
  • Wireshark 1.10.0
  • NetworkManager 0.9.8.2
  • LibreOffice 3.6.6 / 4.0...
  • SystemRescueCd 3.7.0
  • Linux Kernel 3.10 RC6
  • Ubuntu Tweak 0.8.5
  • Home > Linux > Programming > Perl Modules

    HTTP::Async 0.09

    Download button

    No screenshots available
    Downloads: 306  View global page NEW!  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Edmund von der Burg | More programs
    Perl Artistic License / FREE
    January 17th, 2007, 23:05 GMT
    ROOT / Programming / Perl Modules

     Read user reviews (0)  Refer to a friend  Subscribe

    HTTP::Async description

    A Perl module that can process multiple HTTP requests in parallel without blocking.

    HTTP::Async is a Perl module that can process multiple HTTP requests in parallel without blocking.

    SYNOPSIS

    Create an object and add some requests to it:
    use HTTP::Async;
    my $async = HTTP::Async->new;

    # create some requests and add them to the queue.
    $async->add( HTTP::Request->new( GET => 'http://www.perl.org/' ) );
    $async->add( HTTP::Request->new( GET => 'http://www.ecclestoad.co.uk/' ) );
    and then EITHER process the responses as they come back:
    while ( my $response = $async->wait_for_next_response ) {
    # Do some processing with $response
    }
    OR do something else if there is no response ready:
    while ( $async->not_empty ) {
    if ( my $response = $async->next_response ) {
    # deal with $response
    } else {
    # do something else
    {
    }
    OR just use the async object to fetch stuff in the background and deal with the responses at the end.
    # Do some long code...
    for ( 1 .. 100 ) {
    some_function();
    $async->poke; # lets it check for incoming data.
    }

    while ( my $response = $async->wait_for_next_response ) {
    # Do some processing with $response
    }

    Although using the conventional LWP::UserAgent is fast and easy it does have some drawbacks - the code execution blocks until the request has been completed and it is only possible to process one request at a time. HTTP::Async attempts to address these limitations.

    It gives you a 'Async' object that you can add requests to, and then get the requests off as they finish. The actual sending and receiving of the requests is abstracted. As soon as you add a request it is transmitted, if there are too many requests in progress at the moment they are queued. There is no concept of starting or stopping - it runs continuously.

    Whilst it is waiting to receive data it returns control to the code that called it meaning that you can carry out processing whilst fetching data from the network. All without forking or threading - it is actually done using select lists.

    Product's homepage

    Requirements:

    · Perl

      


    TAGS:

    multiple HTTP requests | process HTTP requests | Perl module | Async | process | multiple

    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM