Term::Filter::Callback(3pm)

Term::Filter::Callback3pm

Simple callback-based wrapper for term::filter

Usage

  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

Overview

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.

Releases

7 releases since Debian 7 (Wheezy); the text changed 2 times.

  1. 7–8
  2. 9–11
  3. 12–13

Author

Jesse Luehrs <doy at tozt dot net>

From libterm-filter-perl 0.03-3 in Debian 13 (Trixie). Parsed by carta from the page's man source.