Plack::...tFilter(3)

✨ NAME ✨

Plack::Middleware::SimpleContentFilter β€” bestie, it filters response content πŸ’…

(also hi yes this whole page lives in the User Contributed Perl Documentation section, that's the manual name, we move on 🫢)


🌸 SYNOPSIS 🌸

okay so picture this, you got an app:

use Plack::Builder;

my $app = sub {
    return [ 200, [ 'Content-Type' => 'text/plain' ], [ 'Hello Foo' ] ];
};

builder {
    enable "Plack::Middleware::SimpleContentFilter",
        filter => sub { s/Foo/Bar/g; };
    $app;
};

and the middleware just swoops in and does the lil substitution on the way out. iconic honestly ✨


πŸ¦‹ DESCRIPTION πŸ¦‹

bestie this middleware is a demo. like, that's its whole thing. run it against your real app and it might break your HTML unless you code the filter callback carefully. not me warning you twice, but consider yourself warned 😭

Plack::Middleware::SimpleContentFilter is a simple content text filter that runs against the response body. that's it, that's the job 🌈

and the way that it only kicks in for responses with a text/* Content-Type? we love a middleware with boundaries πŸ’– no cap, it is only enabled against responses with text/* Content-Type. everything else is not getting filtered, periodt.


πŸ‘‘ AUTHOR πŸ‘‘

Tatsuhiko Miyagawa 🌟 the icon, the legend, the main character of this file.


k bye bestie!! this page came to you from perl v5.42.3, dated 2026-10-18 πŸŽ€ that's the source and the date, folded neatly into a sign-off because we don't do boring footers here πŸ«ΆπŸ’œ go filter responsibly, mwah ✨</pink

πŸ“¦ where this page comes from