{
    "mode": "perldoc",
    "parameter": "Net::HTTP::NB",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/Net%3A%3AHTTP%3A%3ANB/json",
    "generated": "2026-06-15T14:43:22Z",
    "synopsis": "use Net::HTTP::NB;\nmy $s = Net::HTTP::NB->new(Host => \"www.perl.com\") || die $@;\n$s->writerequest(GET => \"/\");\nuse IO::Select;\nmy $sel = IO::Select->new($s);\nREADHEADER: {\ndie \"Header timeout\" unless $sel->canread(10);\nmy($code, $mess, %h) = $s->readresponseheaders;\nredo READHEADER unless $code;\n}\nwhile (1) {\ndie \"Body timeout\" unless $sel->canread(10);\nmy $buf;\nmy $n = $s->readentitybody($buf, 1024);\nlast unless $n;\nprint $buf;\n}",
    "sections": {
        "NAME": {
            "content": "Net::HTTP::NB - Non-blocking HTTP client\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 6.22\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "use Net::HTTP::NB;\nmy $s = Net::HTTP::NB->new(Host => \"www.perl.com\") || die $@;\n$s->writerequest(GET => \"/\");\n\nuse IO::Select;\nmy $sel = IO::Select->new($s);\n\nREADHEADER: {\ndie \"Header timeout\" unless $sel->canread(10);\nmy($code, $mess, %h) = $s->readresponseheaders;\nredo READHEADER unless $code;\n}\n\nwhile (1) {\ndie \"Body timeout\" unless $sel->canread(10);\nmy $buf;\nmy $n = $s->readentitybody($buf, 1024);\nlast unless $n;\nprint $buf;\n}\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Same interface as \"Net::HTTP\" but it will never try multiple reads when the",
            "subsections": [
                {
                    "name": "read_response_headers",
                    "content": "multiplex multiple Net::HTTP::NB using select without risk blocking.\n\nIf readresponseheaders() did not see enough data to complete the headers an empty list is\nreturned.\n\nIf readentitybody() did not see new entity data in its read the value -1 is returned.\n"
                }
            ]
        },
        "SEE ALSO": {
            "content": "Net::HTTP\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Gisle Aas <gisle@activestate.com>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This software is copyright (c) 2001 by Gisle Aas.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n",
            "subsections": []
        }
    },
    "summary": "Net::HTTP::NB - Non-blocking HTTP client",
    "flags": [],
    "examples": [],
    "see_also": []
}