Plack::...tLength(3)

πŸ’– Plack::Middleware::ContentLength β€” or as the man page header calls it, Plack::...tLength(3) ✨

okay bestie, gather round, because this one is a little slice of Perl-flavored heaven from the User Contributed Perl Documentation collection 🫢


🌸 NAME 🌸

Plack::Middleware::ContentLength β€” it adds the Content-Length header for you, automatically, no cap πŸ’…


✨ SYNOPSIS ✨

like, here's the vibe. first up, in your app.psgi:

# in app.psgi

builder {
    enable "Plack::Middleware::ContentLength";
    $app;
}

or, if you're doing it in Plack::Handler::* instead:

# Or in Plack::Handler::*

$app = Plack::Middleware::ContentLength->wrap($app);

see? two ways, both iconic, pick your fighter πŸŽ€


πŸ¦‹ DESCRIPTION πŸ¦‹

Plack::Middleware::ContentLength is a middleware that automatically adds the "Content-Length" header when it's appropriate β€” okay so what counts as appropriate? literally: when the response has a content body with a calculable size. and what has a calculable size, you ask? an array of chunks, or a real filehandle. that's it, that's the tea β˜•

and here's the lowkey underrated part: this middleware can also be used as a library from PSGI server implementations 🌈 so instead of setting Content-Length at the end user level, the server implementations can just set it themselves. delegation, but make it slay πŸ‘‘


πŸ‘‘ AUTHOR πŸ‘‘

Tatsuhiko Miyagawa β€” the icon, the moment, the main character πŸ’–


πŸ’œ SEE ALSO πŸ’œ

  • Rack::ContentLength β€” yes bestie, the Rack girlies have one too, we're all connected πŸ¦‹

fr fr, that's the whole page. every flag, every behavior, every vibe β€” all accounted for, no details ghosted πŸ’€

and that's a wrap, my love! 🌸 this lil' page came to you courtesy of perl v5.42.3, dated 2026-10-18, filed under Plack::...tLength(3). obsessed with her. periodt πŸ’…βœ¨

πŸ“¦ where this page comes from