115 lines
2.6 KiB
HTML
115 lines
2.6 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of Net::HTTP::NB</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>Net::HTTP::NB</H1>
|
|
Section: User Contributed Perl Documentation (3pm)<BR>Updated: 2019-07-18<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
Net::HTTP::NB - Non-blocking HTTP client
|
|
<A NAME="lbAC"> </A>
|
|
<H2>VERSION</H2>
|
|
|
|
|
|
|
|
version 6.19
|
|
<A NAME="lbAD"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
|
|
|
|
|
|
|
|
<PRE>
|
|
use Net::HTTP::NB;
|
|
my $s = Net::HTTP::NB->new(Host => "<A HREF="http://www.perl.com">www.perl.com</A>") || die $@;
|
|
$s->write_request(GET => "/");
|
|
|
|
use IO::Select;
|
|
my $sel = IO::Select->new($s);
|
|
|
|
READ_HEADER: {
|
|
die "Header timeout" unless $sel->can_read(10);
|
|
my($code, $mess, %h) = $s->read_response_headers;
|
|
redo READ_HEADER unless $code;
|
|
}
|
|
|
|
while (1) {
|
|
die "Body timeout" unless $sel->can_read(10);
|
|
my $buf;
|
|
my $n = $s->read_entity_body($buf, 1024);
|
|
last unless $n;
|
|
print $buf;
|
|
}
|
|
|
|
</PRE>
|
|
|
|
|
|
<A NAME="lbAE"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
|
|
|
|
Same interface as <TT>"Net::HTTP"</TT> but it will never try multiple reads
|
|
when the <B>read_response_headers()</B> or <B>read_entity_body()</B> methods are
|
|
invoked. This make it possible to multiplex multiple Net::HTTP::NB
|
|
using select without risk blocking.
|
|
<P>
|
|
|
|
If <B>read_response_headers()</B> did not see enough data to complete the
|
|
headers an empty list is returned.
|
|
<P>
|
|
|
|
If <B>read_entity_body()</B> did not see new entity data in its read
|
|
the value -1 is returned.
|
|
<A NAME="lbAF"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
|
|
|
|
Net::HTTP
|
|
<A NAME="lbAG"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
|
|
|
|
Gisle Aas <<A HREF="mailto:gisle@activestate.com">gisle@activestate.com</A>>
|
|
<A NAME="lbAH"> </A>
|
|
<H2>COPYRIGHT AND LICENSE</H2>
|
|
|
|
|
|
|
|
This software is copyright (c) 2001-2017 by Gisle Aas.
|
|
<P>
|
|
|
|
This is free software; you can redistribute it and/or modify it under
|
|
the same terms as the Perl 5 programming language system itself.
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">VERSION</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">SYNOPSIS</A><DD>
|
|
<DT id="4"><A HREF="#lbAE">DESCRIPTION</A><DD>
|
|
<DT id="5"><A HREF="#lbAF">SEE ALSO</A><DD>
|
|
<DT id="6"><A HREF="#lbAG">AUTHOR</A><DD>
|
|
<DT id="7"><A HREF="#lbAH">COPYRIGHT AND LICENSE</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:49 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|