Dancer::HTTP(3pm)

Dancer::HTTP3pm

Helper for rendering http status codes for dancer

Version

version 1.3521

Overview

Helper for rendering HTTP status codes for Dancer

Methods

status( $status )

Returns the numerical status of $status.

    # all three are equivalent, and will return '405'
    $x = Dancer::HTTP->status( 405 );
    $x = Dancer::HTTP->status( 'Method Not Allowed' );
    $x = Dancer::HTTP->status( 'method_not_allowed' );

codes

Returns a hashref of all HTTP status known to "Dancer". The keys are the numerical statuses and the values their string equivalents.

    print Dancer::HTTP->codes->{404}; # prints 'File Not Found'

HTTP codes

The following codes/aliases are understood by any status() call made from a Dancer script. The aliases can be used as-is (e.g., Moved Permanently), or as lower-case string with all non-alphanumerical characters changed to underscores (e.g., moved_permanently).

    get '/user/:user' => sub {
        my $user = find_user( param('user') );
        unless ( $user ) {
            status 404;
            # or could be
            status 'not_found';
            # or even
            status 'Not Found';
        }
        ...
    };

Processed Codes

200 - OK
201 - Created
202 - Accepted
204 - No Content
205 - Reset Content
206 - Partial Content

Redirections

301 - Moved Permanently
302 - Found
304 - Not Modified
306 - Switch Proxy

Problem with request

400 - Bad Request
401 - Unauthorized
402 - Payment Required
403 - Forbidden
404 - Not Found
405 - Method Not Allowed
406 - Not Acceptable
407 - Proxy Authentication Required
408 - Request Timeout
409 - Conflict
410 - Gone
411 - Length Required
412 - Precondition Failed
413 - Request Entity Too Large
414 - Request-URI Too Long
415 - Unsupported Media Type
416 - Requested Range Not Satisfiable
417 - Expectation Failed

Problem with server

500 - Internal Server Error

Also aliases as 'error'.

501 - Not Implemented
502 - Bad Gateway
503 - Service Unavailable
504 - Gateway Timeout
505 - HTTP Version Not Supported

Source code

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

Releases

7 releases since Debian 7 (Wheezy); the text changed 5 times.

  1. 7
  2. 8
  3. 9
  4. 10
  5. 11
  6. 12–13

Author

This module has been written by Alexis Sukrieh <[email protected]>

License

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

Author

Dancer Core Developers

From libdancer-perl 1.3521+dfsg-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.