Term::...llback(3pm)
π Term::Filter::Callback π
okay bestie, so this is a page from the User Contributed Perl Documentation section of the manual, and it's about Term::Filter::Callback β a little module that's genuinely so iconic. it's the simple callback-based wrapper for Term::Filter, iykyk π«Ά
β¨ NAME β¨
Term::Filter::Callback β a simple callback-based wrapper for Term::Filter. that's the whole vibe. slay.
πΈ VERSION πΈ
version 0.03. yes, it's giving small number, but she works fr fr π
π SYNOPSIS π
okay so here's the whole thing in action, look at her go:
use Term::Filter::Callback;
my $term = Term::Filter::Callback->new(
callbacks => {
munge_input => sub {
my $self = shift;
my ($got) = @_;
$got =~ s/\ce/E- Elbereth\n/g;
$got;
},
munge_output => sub {
my $self = shift;
my ($got) = @_;
$got =~ s/(Elbereth)/\e[35m$1\e[m/g;
$got;
},
},
);
$term->run('nethack');
like. that's it. that's the whole setup. no subclassing, no boilerplate, no drama π and then you just run nethack and your Elbereths come out purple. main character energy honestly.
π¦ DESCRIPTION π¦
so this module hands you a callback-based API to Term::Filter. the whole point is: you can just pass the callbacks you want straight into the constructor of this class instead of having to sit there and manually define a whole new class like some kind of Victorian programmer π
and the big flex β this class consumes the Term::Filter role, so literally all the rest of the documentation over in that module applies here too. periodt. go read it. it's your homework bestie πβ¨
π ATTRIBUTES π
π callbacks
a hashref of callbacks for Term::Filter.
- the keys are the callback names
- the values are the coderefs to call for those callbacks
that's it. that's the attribute. simple, clean, iconic π
π AUTHOR π
Jesse Luehrs <doy at tozt dot net> β thank you for your service π«Άβ¨
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2012 by Jesse Luehrs.
and it's free software bestie β you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. no cap, that's genuinely generous of her π
β little sign-off moment: this page is from perl v5.34.0 and it got dated 2022-06-17. so yeah, go forth and munge some input, gorgeous π§π πΈ
π¦ where this page comes from
- debian bookworm: libterm-filter-perl 0.03-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libterm-filter-perl 0.03-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libterm-filter-perl 0.03-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libterm-filter-perl 0.03-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libterm-filter-perl 0.03-3 Β· 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