GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Dancer::HTTP(3) User Contributed Perl Documentation Dancer::HTTP(3)

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

version 1.3513

Helper for rendering HTTP status codes for Dancer

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' );

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'

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';
        }

        ...
    };

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

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

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

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

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

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

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

Dancer Core Developers

This software is copyright (c) 2010 by Alexis Sukrieh.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2020-01-29 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.