HTTP::...:lines(3pm)
π HTTP::Proxy::BodyFilter::lines β the manual, but make it cute π
okay bestie, you know how sometimes a filter just wants a whole line and not a sad little half-line? that's this one. it's HTTP::Proxy::BodyFilter::lines, from the User Contributed Perl Documentation collection, and it is genuinely the moment. β¨
πΈ NAME πΈ
HTTP::Proxy::BodyFilter::lines β a filter that outputs only complete lines. that's it, that's the whole personality. she does one thing and she does it beautifully. π
β¨ SYNOPSIS β¨
like. just look at her.
use HTTP::Proxy::BodyFilter::lines;
use MyFilter; # this filter only works on complete lines
my $filter = MyFilter->new();
# stack both filters so that they'll handle text/* responses
$proxy->push_filter(
mime => 'text/*',
response => HTTP::Proxy::BodyFilter::lines->new,
response => $filter
);
# I want my lines to end with '!'
# This is equivalent to $/ = '!' in a normal Perl program
my $lines = HTTP::Proxy::BodyFilter::lines->new('!');
see that? stacking. you push the lines filter and then your own filter, and the lines one goes first so your filter gets pretty little complete lines instead of chaos. no cap. π«Ά
π DESCRIPTION π
so the tea is: the HTTP::Proxy::BodyFilter::lines filter makes sure that the next filter in the filter chain will only receive complete lines. it's giving bodyguard energy honestly. the "chunks" of data received by the following filters will either end with "\n" or will be the last piece of data for the current HTTP message body. those are the only two options. she does not do in-between. π
and you can lowkey change her whole definition of what a "line" even is by handing the constructor the string she should understand as the line ending. "\n" is the default value, because obviously, it's the main character. π
my $filter = HTTP::Proxy::BodyFilter::lines->new( $sep );
this is basically the same vibe as modifying $/ in a Perl program. and fr fr, the behaviour is so similar to messing with $/ that she also knows about "paragraph mode" and "record mode". she's cultured like that. π
β οΈ but listen. the "slurp" mode is not supported. not happening, not today, not ever. if you want that, please use HTTP::Proxy::BodyFilter::complete to enable the generic store and forward filter mechanism. different filter, different era. π
π¦ METHODS π¦
this filter defines the following methods, which are automatically called. you don't gotta do a thing, she's self-sufficient. main character behaviour honestly. β¨
init()β initialise the filter with the EOL information. setting the stage, doing her little prep routine. πfilter()β keeps unfinished lines for later. she's holding onto them. she's not letting them go half-baked. patient queen. π«Άwill_modify()β this method returns a false value, thus indicating to the system that it will not modify data passing through. she's just vibing, not touching anything, just observing. respectful. πΈ
π SEE ALSO π
- HTTP::Proxy
- HTTP::Proxy::BodyFilter
go read those too bestie, they're the whole ecosystem, iykyk. π§
π AUTHOR π
Philippe "BooK" Bruhat, <book@cpan.org>. an icon, a legend, the moment. π
π 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. slay, honestly. π₯
and that's the whole page bestie!! this was perl v5.36.0, dated 2022-12-04, and it came to you straight from the HTTP::...:lines(3pm) corner of the manual-verse. go forth and filter your lines completely. periodt. πβ¨π
π¦ 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