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

NAME

6       Dancer::HTTP - helper for rendering HTTP status codes for Dancer
7

VERSION

9       version 1.3400
10

DESCRIPTION

12       Helper for rendering HTTP status codes for Dancer
13

METHODS

15   status( $status )
16       Returns the numerical status of $status.
17
18           # all three are equivalent, and will return '405'
19
20           $x = Dancer::HTTP->status( 405 );
21           $x = Dancer::HTTP->status( 'Method Not Allowed' );
22           $x = Dancer::HTTP->status( 'method_not_allowed' );
23
24   codes
25       Returns a hashref of all HTTP status known to "Dancer". The keys are
26       the numerical statuses and the values their string equivalents.
27
28           print Dancer::HTTP->codes->{404}; # prints 'File Not Found'
29

HTTP CODES

31       The following codes/aliases are understood by any status() call made
32       from a Dancer script. The aliases can be used as-is (e.g., Moved
33       Permanently), or as lower-case string with all non-alphanumerical
34       characters changed to underscores (e.g., moved_permanently).
35
36           get '/user/:user' => sub {
37               my $user = find_user( param('user') );
38
39               unless ( $user ) {
40                   status 404;
41
42                   # or could be
43                   status 'not_found';
44
45                   # or even
46                   status 'Not Found';
47               }
48
49               ...
50           };
51
52   Processed Codes
53       200 - OK
54       201 - Created
55       202 - Accepted
56       204 - No Content
57       205 - Reset Content
58       206 - Partial Content
59
60   Redirections
61       301 - Moved Permanently
62       302 - Found
63       304 - Not Modified
64       306 - Switch Proxy
65
66   Problem with request
67       400 - Bad Request
68       401 - Unauthorized
69       402 - Payment Required
70       403 - Forbidden
71       404 - Not Found
72       405 - Method Not Allowed
73       406 - Not Acceptable
74       407 - Proxy Authentication Required
75       408 - Request Timeout
76       409 - Conflict
77       410 - Gone
78       411 - Length Required
79       412 - Precondition Failed
80       413 - Request Entity Too Large
81       414 - Request-URI Too Long
82       415 - Unsupported Media Type
83       416 - Requested Range Not Satisfiable
84       417 - Expectation Failed
85
86   Problem with server
87       500 - Internal Server Error
88           Also aliases as 'error'.
89
90       501 - Not Implemented
91       502 - Bad Gateway
92       503 - Service Unavailable
93       504 - Gateway Timeout
94       505 - HTTP Version Not Supported
95

AUTHOR

97       This module has been written by Alexis Sukrieh <sukria@cpan.org>
98

SOURCE CODE

100       The source code for this module is hosted on GitHub
101       <https://github.com/PerlDancer/Dancer>
102

LICENSE

104       This module is free software and is published under the same terms as
105       Perl itself.
106

AUTHOR

108       Dancer Core Developers
109
111       This software is copyright (c) 2010 by Alexis Sukrieh.
112
113       This is free software; you can redistribute it and/or modify it under
114       the same terms as the Perl 5 programming language system itself.
115
116
117
118perl v5.28.0                      2018-06-15                   Dancer::HTTP(3)
Impressum