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 a 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
43          HTTP_MULTIPLE_CHOICES                (300)
44          HTTP_MOVED_PERMANENTLY               (301)
45          HTTP_FOUND                           (302)
46          HTTP_SEE_OTHER                       (303)
47          HTTP_NOT_MODIFIED                    (304)
48          HTTP_USE_PROXY                       (305)
49          HTTP_TEMPORARY_REDIRECT              (307)
50
51          HTTP_BAD_REQUEST                     (400)
52          HTTP_UNAUTHORIZED                    (401)
53          HTTP_PAYMENT_REQUIRED                (402)
54          HTTP_FORBIDDEN                       (403)
55          HTTP_NOT_FOUND                       (404)
56          HTTP_METHOD_NOT_ALLOWED              (405)
57          HTTP_NOT_ACCEPTABLE                  (406)
58          HTTP_PROXY_AUTHENTICATION_REQUIRED   (407)
59          HTTP_REQUEST_TIMEOUT                 (408)
60          HTTP_CONFLICT                        (409)
61          HTTP_GONE                            (410)
62          HTTP_LENGTH_REQUIRED                 (411)
63          HTTP_PRECONDITION_FAILED             (412)
64          HTTP_REQUEST_ENTITY_TOO_LARGE        (413)
65          HTTP_REQUEST_URI_TOO_LARGE           (414)
66          HTTP_UNSUPPORTED_MEDIA_TYPE          (415)
67          HTTP_REQUEST_RANGE_NOT_SATISFIABLE   (416)
68          HTTP_EXPECTATION_FAILED              (417)
69          HTTP_UNPROCESSABLE_ENTITY            (422)
70          HTTP_LOCKED                          (423)
71          HTTP_FAILED_DEPENDENCY               (424)
72          HTTP_NO_CODE                         (425)
73          HTTP_UPGRADE_REQUIRED                (426)
74          HTTP_RETRY_WITH                      (449)
75
76          HTTP_INTERNAL_SERVER_ERROR           (500)
77          HTTP_NOT_IMPLEMENTED                 (501)
78          HTTP_BAD_GATEWAY                     (502)
79          HTTP_SERVICE_UNAVAILABLE             (503)
80          HTTP_GATEWAY_TIMEOUT                 (504)
81          HTTP_HTTP_VERSION_NOT_SUPPORTED      (505)
82          HTTP_VARIANT_ALSO_NEGOTIATES         (506)
83          HTTP_INSUFFICIENT_STORAGE            (507)
84          HTTP_BANDWIDTH_LIMIT_EXCEEDED        (509)
85          HTTP_NOT_EXTENDED                    (510)
86

FUNCTIONS

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

BUGS

130       For legacy reasons all the "HTTP_" constants are exported by default
131       with the prefix "RC_".  It's recommended to use explict imports and the
132       ":constants" tag instead of relying on this.
133
134
135
136perl v5.10.1                      2009-06-13                   HTTP::Status(3)
Impressum