Term::Filter::Callback - Simple callback-based wrapper for Term::Filter
Contents
Attributes
callbacks
A hashref of callbacks for Term::Filter. The keys are callback names and the values are coderefs to call
for those callbacks.
Copyright And License
This software is copyright (c) 2012 by Jesse Luehrs.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5
programming language system itself.
perl v5.34.0 2022-06-17 Term::Filter::Callback(3pm)
Description
This module provides a callback-based API to Term::Filter. The desired callbacks can just be passed into
the constructor of this class, rather than requiring a new class to be manually defined. This class
consumes the Term::Filter role, so the rest of the documentation in that module applies here.
Name
Term::Filter::Callback - Simple callback-based wrapper for Term::Filter
Synopsis
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');
Version
version 0.03
