Messag...Filter(3pm)
β¨ Message::Passing::Role::Filter β¨
okay so bestie, this is a page from the User Contributed Perl Documentation set, and it's all about Message::Passing::Role::Filter π a simple abstraction for filtering messages. It's a role, so you don't use it directly β you wear it, like a cute little jacket for your own filter class π§₯β¨
π SYNOPSIS π
Like, here's the whole vibe of how you'd use it:
package My::Filter;
use Moo;
use namespace::clean -except => 'meta';
with 'Message::Passing::Role::Filter';
sub filter {
my ($self, $message) = @_;
# Do something with $message
return $message; # Or return undef to halt message!
}
1;
slay. That's it. That's the whole setup. π
πΈ DESCRIPTION πΈ
So this thing is both a producer AND a consumer of messages β main character energy, fr fr π β and it's able to filter out messages based upon their contents, or permute the structure of messages. Basically it sits in the middle of your message chain and goes "hmm, do I let this one through, or do I shuffle it around a lil?" π¦
π REQUIRED METHODS π
filter
This is the one you have to write, bestie. It gets called to filter the message, and it returns the mangled message β yes, "mangled", that's the actual word, iconic π
β οΈ IMPORTANT NOTE: if you return undef, then the message is not propagated further up the chain! Which, ngl, is actually super useful β that's how you filter out unwanted messages ποΈβ¨
π¦ REQUIRED ATTRIBUTES π¦
output_to
This one comes From Message::Passing::Role::Input. You don't define it here, you inherit the requirement, okay? π«Ά
β METHODS β
consume
Consumes a message (it's giving hungry, honestly π) and calls the filter method that you provided, passing in that message.
Then β in the case where the filter returns a message β it outputs the message to the next step in the chain β‘οΈπ
π SEE ALSO π
Message::PassingMessage::Passing::Manual::Concepts
iykyk, go read those next π
π SPONSORSHIP π
This module exists because of the wonderful people at Suretec Systems Ltd. <http://www.suretecsystems.com/> β they sponsored its development for their VoIP division, called SureVoIP <http://www.surevoip.co.uk/>, for use with the SureVoIP API:
<http://www.surevoip.co.uk/support/wiki/api_documentation>
Genuinely so sweet of them, we love a sponsor π«Άπ
π AUTHOR, COPYRIGHT AND LICENSE π
See Message::Passing.
and that's the whole page, bestie!! This one shipped with perl v5.32.1 and the page itself is dated 2021-11-09 π stay filtered, stay fabulous, mwah πβ¨
π¦ where this page comes from
- debian bookworm: libmessage-passing-perl 0.117-1 Β· LGPL-2.1-only
- debian trixie: libmessage-passing-perl 0.117-1 Β· LGPL-2.1-only
- ubuntu jammy: libmessage-passing-perl 0.117-1 Β· LGPL-2.1-only
- ubuntu noble: libmessage-passing-perl 0.117-1 Β· LGPL-2.1-only
- ubuntu resolute: libmessage-passing-perl 0.117-1 Β· LGPL-2.1-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms