HTTP::Status - HTTP Status code processing
use HTTP::Status; if ($rc != RC_OK) { print statusMessage($rc), "\n"; } if (isSuccess($rc)) { ... } if (isError($rc)) { ... } if (isRedirect($rc)) { ... }
HTTP::Status is a library of routines for manipulating HTTP Status Codes for libwww-perl.
The following functions can be used as mnemonic status codes:
RC_OK RC_CREATED RC_ACCEPTED RC_NON_AUTHORITATIVE_INFORMATION RC_NO_CONTENT RC_MULTIPLE_CHOICES RC_MOVED_PERMANENTLY RC_MOVED_TEMPORARILY RC_SEE_OTHER RC_NOT_MODIFIED RC_BAD_REQUEST RC_UNAUTHORIZED RC_PAYMENT_REQUIRED RC_FORBIDDEN RC_NOT_FOUND RC_METHOD_NOT_ALLOWED RC_NONE_ACCEPTABLE RC_PROXY_AUTHENTICATION_REQUIRED RC_REQUEST_TIMEOUT RC_CONFLICT RC_GONE RC_AUTHORIZATION_NEEDED RC_INTERNAL_SERVER_ERROR RC_NOT_IMPLEMENTED RC_BAD_GATEWAY RC_SERVICE_UNAVAILABLE RC_GATEWAY_TIMEOUT
The statusMessage() function will translate status codes to human readable strings.
statusMessage()
The isSuccess(), isError(), and isRedirect() functions will return a true value if the passed status code indicates success, and error, or a redirect respectively.
isSuccess()
isError()
isRedirect()
Return user friendly error message for status code $code
$code
Return a true value if $code is a Success status code
Return a true value if $code is a Redirect status code
Return a true value if $code is an Error status code
To install LWP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm LWP
CPAN shell
perl -MCPAN -e shell install LWP
For more information on module installation, please visit the detailed CPAN module installation guide.