Dancer::HTTP(3pm)
β¨ Dancer::HTTP π
okay bestie, real talk: this is the helper for rendering HTTP status codes for Dancer. she's tiny, she's powerful, she's the girl who always knows exactly what number to say when things go wrong. iykyk. πΈ
she lives in Dancer::HTTP, she's a Perl module, and honestly? iconic behavior only.
π VERSION
version 1.3522 β yeah she's from the 1.35xx era and she's still serving. no cap. π
π¦ DESCRIPTION
bestie it's literally in the name: this is a helper for rendering HTTP status codes for Dancer. that's the whole gig. that's her whole personality and she's thriving. β¨
π METHODS
π status( $status )
returns the numerical status of $status. like, you hand her a vibe and she hands you back the digits. π
check it β all three of these are equivalent, and all three return '405':
# 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' );
so yes bestie you can feed her the number, the fancy name, or the lowercase underscore version and she gets it EVERY time. main character energy fr fr. π
πΈ codes
returns a hashref of every HTTP status known to "Dancer". the keys are the numerical statuses and the values are their string equivalents. that's the whole mapping, one big lookup table, gorgeous. β¨
print Dancer::HTTP->codes->{404}; # prints 'File Not Found'
look at that. 404 walks in and 'File Not Found' walks out. chef's kiss. π
π HTTP CODES
so here's the tea β: 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 a lower-case string with all non-alphanumerical characters changed to underscores (e.g., moved_permanently). either way, she understands you. she always does. π«Ά
here's the demo that makes it click:
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';
}
...
};
three different ways to say the same thing and honestly that's so valid of her. pick your fave, she doesn't judge. π
β Processed Codes
the "yes girl, we handled it" squad:
200β OK201β Created202β Accepted204β No Content205β Reset Content206β Partial Content
π§ Redirections
the "not here, go there" crew:
301β Moved Permanently302β Found304β Not Modified306β Switch Proxy
π Problem with request
aka "bestie, that's on you":
400β Bad Request401β Unauthorized402β Payment Required403β Forbidden404β Not Found405β Method Not Allowed406β Not Acceptable407β Proxy Authentication Required408β Request Timeout409β Conflict410β Gone411β Length Required412β Precondition Failed413β Request Entity Too Large414β Request-URI Too Long415β Unsupported Media Type416β Requested Range Not Satisfiable417β Expectation Failed
π Problem with server
aka "okay that one's on us":
500β Internal Server Error- also aliases as
'error'π (very "we don't have time to type the whole thing" of her)
- also aliases as
501β Not Implemented502β Bad Gateway503β Service Unavailable504β Gateway Timeout505β HTTP Version Not Supported
π AUTHOR
this module has been written by Alexis Sukrieh <sukria@cpan.org> π
π SOURCE CODE
the source code for this module is hosted on GitHub <https://github.com/PerlDancer/Dancer> β go look, it's giving open source excellence. π¦
π₯ LICENSE
this module is free software and is published under the same terms as Perl itself. slay. β¨
π AUTHOR
Dancer Core Developers π
π COPYRIGHT AND LICENSE
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. periodt. π
okay that's the whole page bestie, you read all of it, i'm so proud of you π₯Ή
and that's a wrap on Dancer::HTTP, page 3pm, from the User Contributed Perl Documentation collection, generated with perl v5.40.1 back on 2026-05-05. go render some status codes, you absolute icon. πβ¨ππ¦πΈπ
π«Ά
π¦ where this page comes from
- ubuntu stonking: libdancer-perl 1.3522-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms