Manual Pages for UNIX Darwin command on man Net::HTTP::NB
MyWebUniversity

Manual Pages for UNIX Darwin command on man Net::HTTP::NB

Net::HTTP::NB(3) User Contributed Perl Documentation Net::HTTP::NB(3)

NAME

Net::HTTP::NB - Non-blocking HTTP client

SYNOPSIS

use Net::HTTP::NB;

my $s = Net::HTTP::NB->new(Host => "www.perl.com") || die $@;

$s->writerequest(GET => "/");

use IO::Select;

my $sel = IO::Select->new($s);

READHEADER: {

die "Header timeout" unless $sel->canread(10);

my($code, $mess, %h) = $s->readresponseheaders;

redo READHEADER unless $code;

} while (1) {

die "Body timeout" unless $sel->canread(10);

my $buf;

my $n = $s->readentitybody($buf, 1024);

last unless $n;

print $buf;

}

DESCRIPTION

Same interface as "Net::HTTP" but it will never try multiple reads when the readresponseheaders() or readentitybody() methods are invoked.

This make it possible to multiplex multiple Net::HTTP::NB using select

without risk blocking. If readresponseheaders() did not see enough data to complete the headers an empty list is returned. If readentitybody() did not see new entity data in its read the value

-1 is returned.

SEE ALSO

Net::HTTP COPYRIGHT Copyright 2001 Gisle Aas. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

perl v5.8.8 2004-11-12 Net::HTTP::NB(3)




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™