File: nethack

package info (click to toggle)
libterm-filter-perl 0.03-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 180 kB
  • sloc: perl: 718; makefile: 6
file content (24 lines) | stat: -rw-r--r-- 495 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env perl
use strict;
use warnings;

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');