NAME

HTTP::Status - HTTP Status code processing

SYNOPSIS

use HTTP::Status;

if ($rc != RC_OK) {
    print status_message($rc), "\n";
}

if (is_success($rc)) { ... }
if (is_error($rc)) { ... }
if (is_redirect($rc)) { ... }

DESCRIPTION

HTTP::Status is a library of routines for defining and classification of HTTP status codes for libwww-perl. Status codes are used to encode the overall outcome of a HTTP response message. Codes correspond to those defined in <draft-ietf-http-v11-spec-06>.

The following functions can be used as mnemonic status code names:

RC_CONTINUE
RC_SWITCHING_PROTOCOLS
RC_OK
RC_CREATED
RC_ACCEPTED
RC_NON_AUTHORITATIVE_INFORMATION
RC_NO_CONTENT
RC_RESET_CONTENT
RC_PARTIAL_CONTENT
RC_MULTIPLE_CHOICES
RC_MOVED_PERMANENTLY
RC_MOVED_TEMPORARILY
RC_SEE_OTHER
RC_NOT_MODIFIED
RC_USE_PROXY
RC_BAD_REQUEST
RC_UNAUTHORIZED
RC_PAYMENT_REQUIRED
RC_FORBIDDEN
RC_NOT_FOUND
RC_METHOD_NOT_ALLOWED
RC_NOT_ACCEPTABLE
RC_PROXY_AUTHENTICATION_REQUIRED
RC_REQUEST_TIMEOUT
RC_CONFLICT
RC_GONE
RC_LENGTH_REQUIRED
RC_PRECONDITION_FAILED
RC_REQUEST_ENTITY_TOO_LARGE
RC_REQUEST_URI_TOO_LARGE
RC_UNSUPPORTED_MEDIA_TYPE
RC_INTERNAL_SERVER_ERROR
RC_NOT_IMPLEMENTED
RC_BAD_GATEWAY
RC_SERVICE_UNAVAILABLE
RC_GATEWAY_TIMEOUT
RC_HTTP_VERSION_NOT_SUPPORTED

The status_message() function will translate status codes to human readable strings.

The is_info(), is_success(), is_error(), and is_redirect() functions will return a TRUE value if the passed status code indicates success, and error, or a redirect respectively.

status_message($code)

Return user friendly error message for status code $code

is_info($code)

Return TRUE if $code is an Informational status code

is_success($code)

Return TRUE if $code is a Successful status code

is_redirect($code)

Return TRUE if $code is a Redirection status code

is_error($code)

Return TRUE if $code is an Error status code