HTTP::...:simple(3pm)
π HTTP::Proxy::HeaderFilter::simple π
bestie. welcome to the HTTP::Proxy::HeaderFilter::simple page, straight outta the User Contributed Perl Documentation. this is the manual, and it's lowkey iconic, so let's get into it π«Ά
β¨ NAME β¨
HTTP::Proxy::HeaderFilter::simple β a whole class for whipping up simple filters with zero drama π
π¦ SYNOPSIS π¦
use HTTP::Proxy::HeaderFilter::simple;
# a simple User-Agent filter
my $filter = HTTP::Proxy::HeaderFilter::simple->new(
sub { $_[1]->header( User_Agent => 'foobar/1.0' ); }
);
$proxy->push_filter( request => $filter );
look at that. three lines and a vibe. no cap πβ¨
πΈ DESCRIPTION πΈ
okay so here's the tea: HTTP::Proxy::HeaderFilter::simple can create BodyFilter without you having to go through the whole entire hassle of building a full-fledged class. like, who has the time?? not us π
all you do is pass a code reference to the filter() method of your filter, hand it over to the constructor, and boom β you get the adequate filter. that's it. that's the whole trick. slay π
π Constructor calling convention π
the constructor gets called with a single code reference. that code reference has to conform to the standard filter() signature for header filters, fr fr:
sub filter { my ( $self, $headers, $message) = @_; ... }
and that code reference is what gets used for the filter() method. periodt π¦
π METHODS π
so this filter "factory" defines all the standard HTTP::Proxy::HeaderFilter methods β but those are only, erm, "proxies" π to the actual CODE references you passed to the constructor. the "proxy" methods are:
filter()begin()end()
two other methods are actually HTTP::Proxy::HeaderFilter::simple methods, and they get called automatically:
init()β initialises the filter instance with the code references that got passed to the constructor β¨can()β returns the actual code reference that's gonna run, and not the "proxy" methods. but if you call it with any name other thanbeginandfilter, it callsUNIVERSAL::can()instead. sneaky but valid π
π SEE ALSO π
HTTP::ProxyHTTP::Proxy::HeaderFilter
go read those too, iykyk π
π AUTHOR π
Philippe "BooK" Bruhat, <book@cpan.org>. king behavior honestly π
π 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. go wild, bestie, just keep it legal π
and that's a wrap! this was HTTP::...:simple(3pm) from perl v5.36.0, dated 2022-12-04. mwah, stan a good manpage, bye bestie π«Άβ¨πΈ
π¦ 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