Provided by: libterm-filter-perl_0.03-1_all
NAME
Term::Filter::Callback - Simple callback-based wrapper for Term::Filter
VERSION
version 0.03
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');
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.
ATTRIBUTES
callbacks A hashref of callbacks for Term::Filter. The keys are callback names and the values are coderefs to call for those callbacks.
AUTHOR
Jesse Luehrs <doy at tozt dot net>
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.