1HTTP::Status(3)       User Contributed Perl Documentation      HTTP::Status(3)
2
3
4

NAME

6       HTTP::Status - HTTP Status code processing
7

SYNOPSIS

9        use HTTP::Status qw(:constants :is status_message);
10
11        if ($rc != HTTP_OK) {
12            print status_message($rc), "\n";
13        }
14
15        if (is_success($rc)) { ... }
16        if (is_error($rc)) { ... }
17        if (is_redirect($rc)) { ... }
18

DESCRIPTION

20       HTTP::Status is a library of routines for defining and classifying HTTP
21       status codes for libwww-perl.  Status codes are used to encode the
22       overall outcome of an HTTP response message.  Codes correspond to those
23       defined in RFC 2616 and RFC 2518.
24

CONSTANTS

26       The following constant functions can be used as mnemonic status code
27       names.  None of these are exported by default.  Use the ":constants"
28       tag to import them all.
29
30          HTTP_CONTINUE                        (100)
31          HTTP_SWITCHING_PROTOCOLS             (101)
32          HTTP_PROCESSING                      (102)
33
34          HTTP_OK                              (200)
35          HTTP_CREATED                         (201)
36          HTTP_ACCEPTED                        (202)
37          HTTP_NON_AUTHORITATIVE_INFORMATION   (203)
38          HTTP_NO_CONTENT                      (204)
39          HTTP_RESET_CONTENT                   (205)
40          HTTP_PARTIAL_CONTENT                 (206)
41          HTTP_MULTI_STATUS                    (207)
42          HTTP_ALREADY_REPORTED                (208)
43
44          HTTP_MULTIPLE_CHOICES                (300)
45          HTTP_MOVED_PERMANENTLY               (301)
46          HTTP_FOUND                           (302)
47          HTTP_SEE_OTHER                       (303)
48          HTTP_NOT_MODIFIED                    (304)
49          HTTP_USE_PROXY                       (305)
50          HTTP_TEMPORARY_REDIRECT              (307)
51
52          HTTP_BAD_REQUEST                     (400)
53          HTTP_UNAUTHORIZED                    (401)
54          HTTP_PAYMENT_REQUIRED                (402)
55          HTTP_FORBIDDEN                       (403)
56          HTTP_NOT_FOUND                       (404)
57          HTTP_METHOD_NOT_ALLOWED              (405)
58          HTTP_NOT_ACCEPTABLE                  (406)
59          HTTP_PROXY_AUTHENTICATION_REQUIRED   (407)
60          HTTP_REQUEST_TIMEOUT                 (408)
61          HTTP_CONFLICT                        (409)
62          HTTP_GONE                            (410)
63          HTTP_LENGTH_REQUIRED                 (411)
64          HTTP_PRECONDITION_FAILED             (412)
65          HTTP_REQUEST_ENTITY_TOO_LARGE        (413)
66          HTTP_REQUEST_URI_TOO_LARGE           (414)
67          HTTP_UNSUPPORTED_MEDIA_TYPE          (415)
68          HTTP_REQUEST_RANGE_NOT_SATISFIABLE   (416)
69          HTTP_EXPECTATION_FAILED              (417)
70          HTTP_I_AM_A_TEAPOT                   (418)
71          HTTP_UNPROCESSABLE_ENTITY            (422)
72          HTTP_LOCKED                          (423)
73          HTTP_FAILED_DEPENDENCY               (424)
74          HTTP_NO_CODE                         (425)
75          HTTP_UPGRADE_REQUIRED                (426)
76          HTTP_PRECONDITION_REQUIRED           (428)
77          HTTP_TOO_MANY_REQUESTS               (429)
78          HTTP_REQUEST_HEADER_FIELDS_TOO_LARGE (431)
79          HTTP_RETRY_WITH                      (449)
80
81          HTTP_INTERNAL_SERVER_ERROR           (500)
82          HTTP_NOT_IMPLEMENTED                 (501)
83          HTTP_BAD_GATEWAY                     (502)
84          HTTP_SERVICE_UNAVAILABLE             (503)
85          HTTP_GATEWAY_TIMEOUT                 (504)
86          HTTP_HTTP_VERSION_NOT_SUPPORTED      (505)
87          HTTP_VARIANT_ALSO_NEGOTIATES         (506)
88          HTTP_INSUFFICIENT_STORAGE            (507)
89          HTTP_BANDWIDTH_LIMIT_EXCEEDED        (509)
90          HTTP_NOT_EXTENDED                    (510)
91          HTTP_NETWORK_AUTHENTICATION_REQUIRED (511)
92

FUNCTIONS

94       The following additional functions are provided.  Most of them are
95       exported by default.  The ":is" import tag can be used to import all
96       the classification functions.
97
98       status_message( $code )
99           The status_message() function will translate status codes to human
100           readable strings. The string is the same as found in the constant
101           names above.  If the $code is unknown, then "undef" is returned.
102
103       is_info( $code )
104           Return TRUE if $code is an Informational status code (1xx).  This
105           class of status code indicates a provisional response which can't
106           have any content.
107
108       is_success( $code )
109           Return TRUE if $code is a Successful status code (2xx).
110
111       is_redirect( $code )
112           Return TRUE if $code is a Redirection status code (3xx). This class
113           of status code indicates that further action needs to be taken by
114           the user agent in order to fulfill the request.
115
116       is_error( $code )
117           Return TRUE if $code is an Error status code (4xx or 5xx).  The
118           function returns TRUE for both client and server error status
119           codes.
120
121       is_client_error( $code )
122           Return TRUE if $code is a Client Error status code (4xx). This
123           class of status code is intended for cases in which the client
124           seems to have erred.
125
126           This function is not exported by default.
127
128       is_server_error( $code )
129           Return TRUE if $code is a Server Error status code (5xx). This
130           class of status codes is intended for cases in which the server is
131           aware that it has erred or is incapable of performing the request.
132
133           This function is not exported by default.
134

BUGS

136       For legacy reasons all the "HTTP_" constants are exported by default
137       with the prefix "RC_".  It's recommended to use explicit imports and
138       the ":constants" tag instead of relying on this.
139
140
141
142perl v5.16.3                      2012-02-16                   HTTP::Status(3)
Impressum