1HTTP::Status(3) User Contributed Perl Documentation HTTP::Status(3)
2
3
4
6 HTTP::Status - HTTP Status code processing
7
9 use HTTP::Status;
10
11 if ($rc != RC_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
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 a HTTP response message. Codes correspond to those
23 defined in RFC 2616 and RFC 2518.
24
26 The following constant functions can be used as mnemonic status code
27 names:
28
29 RC_CONTINUE (100)
30 RC_SWITCHING_PROTOCOLS (101)
31 RC_PROCESSING (102)
32
33 RC_OK (200)
34 RC_CREATED (201)
35 RC_ACCEPTED (202)
36 RC_NON_AUTHORITATIVE_INFORMATION (203)
37 RC_NO_CONTENT (204)
38 RC_RESET_CONTENT (205)
39 RC_PARTIAL_CONTENT (206)
40 RC_MULTI_STATUS (207)
41
42 RC_MULTIPLE_CHOICES (300)
43 RC_MOVED_PERMANENTLY (301)
44 RC_FOUND (302)
45 RC_SEE_OTHER (303)
46 RC_NOT_MODIFIED (304)
47 RC_USE_PROXY (305)
48 RC_TEMPORARY_REDIRECT (307)
49
50 RC_BAD_REQUEST (400)
51 RC_UNAUTHORIZED (401)
52 RC_PAYMENT_REQUIRED (402)
53 RC_FORBIDDEN (403)
54 RC_NOT_FOUND (404)
55 RC_METHOD_NOT_ALLOWED (405)
56 RC_NOT_ACCEPTABLE (406)
57 RC_PROXY_AUTHENTICATION_REQUIRED (407)
58 RC_REQUEST_TIMEOUT (408)
59 RC_CONFLICT (409)
60 RC_GONE (410)
61 RC_LENGTH_REQUIRED (411)
62 RC_PRECONDITION_FAILED (412)
63 RC_REQUEST_ENTITY_TOO_LARGE (413)
64 RC_REQUEST_URI_TOO_LARGE (414)
65 RC_UNSUPPORTED_MEDIA_TYPE (415)
66 RC_REQUEST_RANGE_NOT_SATISFIABLE (416)
67 RC_EXPECTATION_FAILED (417)
68 RC_UNPROCESSABLE_ENTITY (422)
69 RC_LOCKED (423)
70 RC_FAILED_DEPENDENCY (424)
71
72 RC_INTERNAL_SERVER_ERROR (500)
73 RC_NOT_IMPLEMENTED (501)
74 RC_BAD_GATEWAY (502)
75 RC_SERVICE_UNAVAILABLE (503)
76 RC_GATEWAY_TIMEOUT (504)
77 RC_HTTP_VERSION_NOT_SUPPORTED (505)
78 RC_INSUFFICIENT_STORAGE (507)
79
81 The following additional functions are provided. Most of them are
82 exported by default.
83
84 status_message( $code )
85 The status_message() function will translate status codes to human
86 readable strings. The string is the same as found in the constant
87 names above. If the $code is unknown, then "undef" is returned.
88
89 is_info( $code )
90 Return TRUE if $code is an Informational status code. This class
91 of status code indicates a provisional response which can't have
92 any content.
93
94 is_success( $code )
95 Return TRUE if $code is a Successful status code.
96
97 is_redirect( $code )
98 Return TRUE if $code is a Redirection status code. This class of
99 status code indicates that further action needs to be taken by the
100 user agent in order to fulfill the request.
101
102 is_error( $code )
103 Return TRUE if $code is an Error status code. The function return
104 TRUE for both client error or a server error status codes.
105
106 is_client_error( $code )
107 Return TRUE if $code is an Client Error status code. This class of
108 status code is intended for cases in which the client seems to have
109 erred.
110
111 This function is not exported by default.
112
113 is_server_error( $code )
114 Return TRUE if $code is an Server Error status code. This class of
115 status codes is intended for cases in which the server is aware
116 that it has erred or is incapable of performing the request.
117
118 This function is not exported by default.
119
121 Wished @EXPORT_OK had been used instead of @EXPORT in the beginning.
122 Now too much is exported by default.
123
124
125
126perl v5.8.8 2004-04-06 HTTP::Status(3)