.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Dancer::HTTP 3pm" .TH Dancer::HTTP 3pm "2023-02-10" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Dancer::HTTP \- helper for rendering HTTP status codes for Dancer .SH "VERSION" .IX Header "VERSION" version 1.3521 .SH "DESCRIPTION" .IX Header "DESCRIPTION" Helper for rendering \s-1HTTP\s0 status codes for Dancer .SH "METHODS" .IX Header "METHODS" .ie n .SS "status( $status )" .el .SS "status( \f(CW$status\fP )" .IX Subsection "status( $status )" Returns the numerical status of \f(CW$status\fR. .PP .Vb 1 \& # all three are equivalent, and will return \*(Aq405\*(Aq \& \& $x = Dancer::HTTP\->status( 405 ); \& $x = Dancer::HTTP\->status( \*(AqMethod Not Allowed\*(Aq ); \& $x = Dancer::HTTP\->status( \*(Aqmethod_not_allowed\*(Aq ); .Ve .SS "codes" .IX Subsection "codes" Returns a hashref of all \s-1HTTP\s0 status known to \f(CW\*(C`Dancer\*(C'\fR. The keys are the numerical statuses and the values their string equivalents. .PP .Vb 1 \& print Dancer::HTTP\->codes\->{404}; # prints \*(AqFile Not Found\*(Aq .Ve .SH "HTTP CODES" .IX Header "HTTP CODES" The following codes/aliases are understood by any \fBstatus()\fR call made from a Dancer script. The aliases can be used as-is (e.g., \fIMoved Permanently\fR), or as lower-case string with all non-alphanumerical characters changed to underscores (e.g., \fImoved_permanently\fR). .PP .Vb 2 \& get \*(Aq/user/:user\*(Aq => sub { \& my $user = find_user( param(\*(Aquser\*(Aq) ); \& \& unless ( $user ) { \& status 404; \& \& # or could be \& status \*(Aqnot_found\*(Aq; \& \& # or even \& status \*(AqNot Found\*(Aq; \& } \& \& ... \& }; .Ve .SS "Processed Codes" .IX Subsection "Processed Codes" .IP "200 \- \s-1OK\s0" 4 .IX Item "200 - OK" .PD 0 .IP "201 \- Created" 4 .IX Item "201 - Created" .IP "202 \- Accepted" 4 .IX Item "202 - Accepted" .IP "204 \- No Content" 4 .IX Item "204 - No Content" .IP "205 \- Reset Content" 4 .IX Item "205 - Reset Content" .IP "206 \- Partial Content" 4 .IX Item "206 - Partial Content" .PD .SS "Redirections" .IX Subsection "Redirections" .IP "301 \- Moved Permanently" 4 .IX Item "301 - Moved Permanently" .PD 0 .IP "302 \- Found" 4 .IX Item "302 - Found" .IP "304 \- Not Modified" 4 .IX Item "304 - Not Modified" .IP "306 \- Switch Proxy" 4 .IX Item "306 - Switch Proxy" .PD .SS "Problem with request" .IX Subsection "Problem with request" .IP "400 \- Bad Request" 4 .IX Item "400 - Bad Request" .PD 0 .IP "401 \- Unauthorized" 4 .IX Item "401 - Unauthorized" .IP "402 \- Payment Required" 4 .IX Item "402 - Payment Required" .IP "403 \- Forbidden" 4 .IX Item "403 - Forbidden" .IP "404 \- Not Found" 4 .IX Item "404 - Not Found" .IP "405 \- Method Not Allowed" 4 .IX Item "405 - Method Not Allowed" .IP "406 \- Not Acceptable" 4 .IX Item "406 - Not Acceptable" .IP "407 \- Proxy Authentication Required" 4 .IX Item "407 - Proxy Authentication Required" .IP "408 \- Request Timeout" 4 .IX Item "408 - Request Timeout" .IP "409 \- Conflict" 4 .IX Item "409 - Conflict" .IP "410 \- Gone" 4 .IX Item "410 - Gone" .IP "411 \- Length Required" 4 .IX Item "411 - Length Required" .IP "412 \- Precondition Failed" 4 .IX Item "412 - Precondition Failed" .IP "413 \- Request Entity Too Large" 4 .IX Item "413 - Request Entity Too Large" .IP "414 \- Request-URI Too Long" 4 .IX Item "414 - Request-URI Too Long" .IP "415 \- Unsupported Media Type" 4 .IX Item "415 - Unsupported Media Type" .IP "416 \- Requested Range Not Satisfiable" 4 .IX Item "416 - Requested Range Not Satisfiable" .IP "417 \- Expectation Failed" 4 .IX Item "417 - Expectation Failed" .PD .SS "Problem with server" .IX Subsection "Problem with server" .IP "500 \- Internal Server Error" 4 .IX Item "500 - Internal Server Error" Also aliases as 'error'. .IP "501 \- Not Implemented" 4 .IX Item "501 - Not Implemented" .PD 0 .IP "502 \- Bad Gateway" 4 .IX Item "502 - Bad Gateway" .IP "503 \- Service Unavailable" 4 .IX Item "503 - Service Unavailable" .IP "504 \- Gateway Timeout" 4 .IX Item "504 - Gateway Timeout" .IP "505 \- \s-1HTTP\s0 Version Not Supported" 4 .IX Item "505 - HTTP Version Not Supported" .PD .SH "AUTHOR" .IX Header "AUTHOR" This module has been written by Alexis Sukrieh .SH "SOURCE CODE" .IX Header "SOURCE CODE" The source code for this module is hosted on GitHub .SH "LICENSE" .IX Header "LICENSE" This module is free software and is published under the same terms as Perl itself. .SH "AUTHOR" .IX Header "AUTHOR" Dancer Core Developers .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2010 by Alexis Sukrieh. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.