| 1 | =head1 NAME | ||
| 2 | |||
| 3 | Apache2::Controller::Refcard - reference card for Apache2::Controller | ||
| 4 | |||
| 5 | =head1 SYNOPSYS | ||
| 6 | |||
| 7 | =over 2 | ||
| 8 | |||
| 9 | =item HTTP return code reference | ||
| 10 | |||
| 11 | =back | ||
| 12 | |||
| 13 | =head1 DESCRIPTION | ||
| 14 | |||
| 15 | Apache2::Controller::Refcard contains only documentation | ||
| 16 | for L<Apache2::Controller>. | ||
| 17 | |||
| 18 | =head1 SECTIONS | ||
| 19 | |||
| 20 | =head2 status | ||
| 21 | |||
| 22 | If you're like me, you get confused as to which status codes are http | ||
| 23 | status codes and which ones are used internally by Apache2 to signal the | ||
| 24 | &handler subroutine exit status and return or deny further control to | ||
| 25 | the server. | ||
| 26 | |||
| 27 | $r->status is set with the right value, usually HTTP_OK or | ||
| 28 | HTTP_(which might be overridden by an error in case an | ||
| 29 | exception is thrown somewhere with ), and then handler() returns | ||
| 30 | Apache2::Const::OK in any case. So far. This might change if | ||
| 31 | someone gets me wise to what's actually going on. | ||
| 32 | |||
| 33 | RC Apache2::Const::* HTTP::Status::status_message($RC) | ||
| 34 | ----------------------------------------------------------------------- | ||
| 35 | -02 DONE - | ||
| 36 | -01 DECLINED - | ||
| 37 | 000 OK - | ||
| 38 | 100 HTTP_CONTINUE Continue | ||
| 39 | 101 HTTP_SWITCHING_PROTOCOLS Switching Protocols | ||
| 40 | 102 HTTP_PROCESSING Processing | ||
| 41 | 200 HTTP_OK OK | ||
| 42 | 201 HTTP_CREATED Created | ||
| 43 | 202 HTTP_ACCEPTED Accepted | ||
| 44 | 203 HTTP_NON_AUTHORITATIVE Non-Authoritative Information | ||
| 45 | 204 HTTP_NO_CONTENT No Content | ||
| 46 | 205 HTTP_RESET_CONTENT Reset Content | ||
| 47 | 206 HTTP_PARTIAL_CONTENT Partial Content | ||
| 48 | 207 HTTP_MULTI_STATUS Multi-Status | ||
| 49 | 300 HTTP_MULTIPLE_CHOICES Multiple Choices | ||
| 50 | 301 HTTP_MOVED_PERMANENTLY Moved Permanently | ||
| 51 | 302 HTTP_MOVED_TEMPORARILY Found | ||
| 52 | 302 REDIRECT Found | ||
| 53 | 303 HTTP_SEE_OTHER See Other | ||
| 54 | 304 HTTP_NOT_MODIFIED Not Modified | ||
| 55 | 305 HTTP_USE_PROXY Use Proxy | ||
| 56 | 307 HTTP_TEMPORARY_REDIRECT Temporary Redirect | ||
| 57 | 400 HTTP_BAD_REQUEST Bad Request | ||
| 58 | 401 AUTH_REQUIRED Unauthorized | ||
| 59 | 401 HTTP_UNAUTHORIZED Unauthorized | ||
| 60 | 402 HTTP_PAYMENT_REQUIRED Payment Required | ||
| 61 | 403 FORBIDDEN Forbidden | ||
| 62 | 403 HTTP_FORBIDDEN Forbidden | ||
| 63 | 404 HTTP_NOT_FOUND Not Found | ||
| 64 | 404 NOT_FOUND Not Found | ||
| 65 | 405 HTTP_METHOD_NOT_ALLOWED Method Not Allowed | ||
| 66 | 406 HTTP_NOT_ACCEPTABLE Not Acceptable | ||
| 67 | 407 HTTP_PROXY_AUTHENTICATION_REQUIRED Proxy Authentication Required | ||
| 68 | 408 HTTP_REQUEST_TIME_OUT Request Timeout | ||
| 69 | 409 HTTP_CONFLICT Conflict | ||
| 70 | 410 HTTP_GONE Gone | ||
| 71 | 411 HTTP_LENGTH_REQUIRED Length Required | ||
| 72 | 412 HTTP_PRECONDITION_FAILED Precondition Failed | ||
| 73 | 413 HTTP_REQUEST_ENTITY_TOO_LARGE Request Entity Too Large | ||
| 74 | 414 HTTP_REQUEST_URI_TOO_LARGE Request-URI Too Large | ||
| 75 | 415 HTTP_UNSUPPORTED_MEDIA_TYPE Unsupported Media Type | ||
| 76 | 416 HTTP_RANGE_NOT_SATISFIABLE Request Range Not Satisfiable | ||
| 77 | 417 HTTP_EXPECTATION_FAILED Expectation Failed | ||
| 78 | 500 HTTP_INTERNAL_SERVER_ERROR Internal Server Error | ||
| 79 | 500 SERVER_ERROR Internal Server Error | ||
| 80 | 501 HTTP_NOT_IMPLEMENTED Not Implemented | ||
| 81 | 502 HTTP_BAD_GATEWAY Bad Gateway | ||
| 82 | 503 HTTP_SERVICE_UNAVAILABLE Service Unavailable | ||
| 83 | 504 HTTP_GATEWAY_TIME_OUT Gateway Timeout | ||
| 84 | 506 HTTP_VARIANT_ALSO_VARIES Variant Also Negotiates | ||
| 85 | 507 HTTP_INSUFFICIENT_STORAGE Insufficient Storage | ||
| 86 | 510 HTTP_NOT_EXTENDED Not Extended | ||
| 87 | |||
| 88 | |||
| 89 | For reference, a utility script has been included in the build directory, | ||
| 90 | utils/apache2_http_response_reference_list.pl. This dumps the :common | ||
| 91 | and :http constants from Apache2::Const and lists their names alongside the | ||
| 92 | corresponding status_message() strings from HTTP::Status. This is the | ||
| 93 | resulting list of codes and corresponding HTTP::Status messages. | ||
| 94 | |||
| 95 | use strict; | ||
| 96 | use warnings; | ||
| 97 | |||
| 98 | use HTTP::Status; | ||
| 99 | use Apache2::Const qw( | ||
| 100 | :common :http | ||
| 101 | ); | ||
| 102 | |||
| 103 | my @tags; | ||
| 104 | |||
| 105 | my %syms = %Apache2::Const:: ; | ||
| 106 | CONST_SYM: | ||
| 107 | for my $sym ( sort keys %syms ) { | ||
| 108 | my $code = *{$syms{$sym}}{CODE}; | ||
| 109 | push @tags, $sym if defined $code && uc $sym eq $sym; | ||
| 110 | } | ||
| 111 | |||
| 112 | my %numbers; | ||
| 113 | |||
| 114 | for my $tag (@tags) { | ||
| 115 | my $number; | ||
| 116 | eval '$number = Apache2::Const::'.$tag.';'; | ||
| 117 | $numbers{$tag} = $number; | ||
| 118 | } | ||
| 119 | |||
| 120 | print sprintf( | ||
| 121 | "%3s %35s %33s", 'RC', 'Apache2::Const::*', 'HTTP::Status::status_message' | ||
| 122 | ), "\n", '-' x 77, "\n"; | ||
| 123 | |||
| 124 | for my $tag (sort { $numbers{$a} <=> $numbers{$b} } @tags) { | ||
| 125 | my $number = $numbers{$tag}; | ||
| 126 | my $lookup = status_message($number) || '-'; | ||
| 127 | print sprintf("%03d %35s %35s", $number, $tag, $lookup), "\n"; | ||
| 128 | } | ||
| 129 | |||
| 130 | =head1 SEE ALSO | ||
| 131 | |||
| 132 | L<Apache2::Controller> | ||
| 133 | |||
| 134 | =head1 AUTHOR | ||
| 135 | |||
| 136 | Mark Hedges, C<hedges +(a t)- formdata.biz> | ||
| 137 | |||
| 138 | =head1 COPYRIGHT AND LICENSE | ||
| 139 | |||
| 140 | Copyright 2008-2010 Mark Hedges. CPAN: markle | ||
| 141 | |||
| 142 | This library is free software; you can redistribute it and/or modify | ||
| 143 | it under the same terms as Perl itself. | ||
| 144 | |||
| 145 | This software is provided as-is, with no warranty | ||
| 146 | and no guarantee of fitness | ||
| 147 | for any particular purpose. | ||
| 148 | |||
| 149 | =cut | ||
| 150 | |||
| 151 | 2 | 1; |