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 β€” OK
  • 201 β€” Created
  • 202 β€” Accepted
  • 204 β€” No Content
  • 205 β€” Reset Content
  • 206 β€” Partial Content

🧚 Redirections

the "not here, go there" crew:

  • 301 β€” Moved Permanently
  • 302 β€” Found
  • 304 β€” Not Modified
  • 306 β€” Switch Proxy

πŸ’€ Problem with request

aka "bestie, that's on you":

  • 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

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)
  • 501 β€” Not Implemented
  • 502 β€” Bad Gateway
  • 503 β€” Service Unavailable
  • 504 β€” Gateway Timeout
  • 505 β€” 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 πŸ‘‘


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