HTTP::...tmltext(3pm)
π HTTP::Proxy::BodyFilter::htmltext π
ok bestie, you found the User Contributed Perl Documentation for HTTP::Proxy::BodyFilter::htmltext and honestly? it's giving main character energy. no cap.
β¨ NAME β¨
HTTP::Proxy::BodyFilter::htmltext β a filter to transmogrify HTML text π
like, it takes your HTML text and transforms it. that's the whole vibe.
πΈ SYNOPSIS πΈ
use HTTP::Proxy::BodyFilter::tags;
use HTTP::Proxy::BodyFilter::htmltext;
# could it be any simpler?
$proxy->push_filter(
mime => 'text/html',
response => HTTP::Proxy::BodyFilter::tags->new,
response => HTTP::Proxy::BodyFilter::htmltext->new(
sub { tr/a-zA-z/n-za-mN-ZA-M/ }
)
);
literally the comment in the original asks "# could it be any simpler?" and bestie, the answer is no. it cannot. π
π¦ DESCRIPTION π¦
okay so. HTTP::Proxy::BodyFilter::htmltext is a filter spawner. that means it calls the callback of your choice on any HTML text β but only on actual text, meaning stuff that's outside <script> and <style> tags, and outside entities too. so it won't go messing with your code or your &s. iconic behaviour, honestly. π
your subroutine should modify the content of $_ as it sees fit. that's it. that's the API.
Simple, and terribly efficient. β¨
π METHODS π
these methods are defined by the filter and get called automatically β you don't have to poke them yourself:
init()β makes sure the filter is initialised with aCODEreference. gotta have your callback ready, no exceptions.begin()β per page parser initialisation. every page gets a fresh start, as it deserves. π±filter()β a simple HTML parser that runs the given callback on the text contained in the HTML data. π«Ά
lowkey if you need something more elaborate, please go look at HTTP::Proxy::BodyFilter::htmlparser instead. this one is the simple queen and she's staying that way. π
π₯ SEE ALSO π₯
HTTP::ProxyHTTP::Proxy::BodyFilterHTTP::Proxy::BodyFilter::htmlparser
go read those too, bestie. iykyk.
π AUTHOR π
Philippe "BooK" Bruhat, <book@cpan.org>.
β COPYRIGHT β
Copyright 2003-2015, Philippe Bruhat.
π LICENSE π
This module is free software; you can redistribute it or modify it under the same terms as Perl itself.
and that's the whole page, fr fr. this one shipped as part of perl v5.36.0, dated 2022-12-04 π β so yeah, go forth and transmogrify your HTML text. you ate. πβ¨π¦
π¦ where this page comes from
- debian bookworm: libhttp-proxy-perl 0.304-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libhttp-proxy-perl 0.304-5 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libhttp-proxy-perl 0.304-5 Β· 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