DOKK / manpages / debian 12 / libplack-perl / Plack::Middleware::SimpleContentFilter.3pm.en
Plack::Middleware::SimpleContentFilter(3pm) User Contributed Perl Documentation Plack::Middleware::SimpleContentFilter(3pm)

Plack::Middleware::SimpleContentFilter - Filters response content

  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;
  };

This middleware should be considered as a demo. Running this against your application might break your HTML unless you code the filter callback carefully.

Plack::Middleware::SimpleContentFilter is a simple content text filter to run against response body. This middleware is only enabled against responses with "text/*" Content-Type.

Tatsuhiko Miyagawa

2022-09-06 perl v5.34.0