Dancer::HTTP - helper for rendering HTTP status codes for Dancer
version 1.3203
Helper for rendering HTTP status codes for Dancer
Returns the numerical status of $status.
$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.
Dancer
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'; } ... };
Also aliases as 'error'.
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.
To install Dancer, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Dancer
CPAN shell
perl -MCPAN -e shell install Dancer
For more information on module installation, please visit the detailed CPAN module installation guide.