{
    "mode": "perldoc",
    "parameter": "LWP::Simple",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/LWP%3A%3ASimple/json",
    "generated": "2026-06-09T13:11:45Z",
    "synopsis": "perl -MLWP::Simple -e 'getprint \"http://www.sn.no\"'\nuse LWP::Simple;\n$content = get(\"http://www.sn.no/\");\ndie \"Couldn't get it!\" unless defined $content;\nif (mirror(\"http://www.sn.no/\", \"foo\") == RCNOTMODIFIED) {\n...\n}\nif (issuccess(getprint(\"http://www.sn.no/\"))) {\n...\n}",
    "sections": {
        "NAME": {
            "content": "LWP::Simple - simple procedural interface to LWP\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "perl -MLWP::Simple -e 'getprint \"http://www.sn.no\"'\n\nuse LWP::Simple;\n$content = get(\"http://www.sn.no/\");\ndie \"Couldn't get it!\" unless defined $content;\n\nif (mirror(\"http://www.sn.no/\", \"foo\") == RCNOTMODIFIED) {\n...\n}\n\nif (issuccess(getprint(\"http://www.sn.no/\"))) {\n...\n}\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module is meant for people who want a simplified view of the libwww-perl library. It should\nalso be suitable for one-liners. If you need more control or access to the header fields in the\nrequests sent and responses received, then you should use the full object-oriented interface\nprovided by the LWP::UserAgent module.\n\nThe module will also export the LWP::UserAgent object as $ua if you ask for it explicitly.\n\nThe user agent created by this module will identify itself as \"LWP::Simple/#.##\" and will\ninitialize its proxy defaults from the environment (by calling \"$ua->envproxy\").\n",
            "subsections": []
        },
        "FUNCTIONS": {
            "content": "The following functions are provided (and exported) by this module:\n\nget\nmy $res = get($url);\n\nThe get() function will fetch the document identified by the given URL and return it. It returns\n\"undef\" if it fails. The $url argument can be either a string or a reference to a URI object.\n\nYou will not be able to examine the response code or response headers (like \"Content-Type\") when\nyou are accessing the web using this function. If you need that information you should use the\nfull OO interface (see LWP::UserAgent).\n\nhead\nmy $res = head($url);\n\nGet document headers. Returns the following 5 values if successful: ($contenttype,\n$documentlength, $modifiedtime, $expires, $server)\n\nReturns an empty list if it fails. In scalar context returns TRUE if successful.\n\ngetprint\nmy $code = getprint($url);\n\nGet and print a document identified by a URL. The document is printed to the selected default\nfilehandle for output (normally STDOUT) as data is received from the network. If the request\nfails, then the status code and message are printed on STDERR. The return value is the HTTP\nresponse code.\n\ngetstore\nmy $code = getstore($url, $file)\n\nGets a document identified by a URL and stores it in the file. The return value is the HTTP\nresponse code.\n\nmirror\nmy $code = mirror($url, $file);\n\nGet and store a document identified by a URL, using *If-modified-since*, and checking the\n*Content-Length*. Returns the HTTP response code.\n",
            "subsections": []
        },
        "STATUS CONSTANTS": {
            "content": "This module also exports the HTTP::Status constants and procedures. You can use them when you\ncheck the response code from \"getprint\" in LWP::Simple, \"getstore\" in LWP::Simple or \"mirror\" in\nLWP::Simple. The constants are:\n\nRCCONTINUE\nRCSWITCHINGPROTOCOLS\nRCOK\nRCCREATED\nRCACCEPTED\nRCNONAUTHORITATIVEINFORMATION\nRCNOCONTENT\nRCRESETCONTENT\nRCPARTIALCONTENT\nRCMULTIPLECHOICES\nRCMOVEDPERMANENTLY\nRCMOVEDTEMPORARILY\nRCSEEOTHER\nRCNOTMODIFIED\nRCUSEPROXY\nRCBADREQUEST\nRCUNAUTHORIZED\nRCPAYMENTREQUIRED\nRCFORBIDDEN\nRCNOTFOUND\nRCMETHODNOTALLOWED\nRCNOTACCEPTABLE\nRCPROXYAUTHENTICATIONREQUIRED\nRCREQUESTTIMEOUT\nRCCONFLICT\nRCGONE\nRCLENGTHREQUIRED\nRCPRECONDITIONFAILED\nRCREQUESTENTITYTOOLARGE\nRCREQUESTURITOOLARGE\nRCUNSUPPORTEDMEDIATYPE\nRCINTERNALSERVERERROR\nRCNOTIMPLEMENTED\nRCBADGATEWAY\nRCSERVICEUNAVAILABLE\nRCGATEWAYTIMEOUT\nRCHTTPVERSIONNOTSUPPORTED\n",
            "subsections": []
        },
        "CLASSIFICATION FUNCTIONS": {
            "content": "The HTTP::Status classification functions are:\n\nissuccess\nmy $bool = issuccess($rc);\n\nTrue if response code indicated a successful request.\n\niserror\nmy $bool = iserror($rc)\n\nTrue if response code indicated that an error occurred.\n",
            "subsections": []
        },
        "CAVEAT": {
            "content": "Note that if you are using both LWP::Simple and the very popular CGI module, you may be\nimporting a \"head\" function from each module, producing a warning like \"Prototype mismatch: sub\nmain::head ($) vs none\". Get around this problem by just not importing LWP::Simple's \"head\"\nfunction, like so:\n\nuse LWP::Simple qw(!head);\nuse CGI qw(:standard);  # then only CGI.pm defines a head()\n\nThen if you do need LWP::Simple's \"head\" function, you can just call it as\n\"LWP::Simple::head($url)\".\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "LWP, lwpcook, LWP::UserAgent, HTTP::Status, lwp-request, lwp-mirror\n",
            "subsections": []
        }
    },
    "summary": "LWP::Simple - simple procedural interface to LWP",
    "flags": [],
    "examples": [],
    "see_also": []
}