File: readline

package info (click to toggle)
libtest-expect-perl 0.34-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 96 kB
  • ctags: 11
  • sloc: perl: 134; makefile: 2
file content (19 lines) | stat: -rw-r--r-- 329 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!perl
use strict;
use warnings;
use Term::ReadLine;

my $what = (shift @ARGV) || "there";
print "* Hi $what, to readline\n";

my $term = Term::ReadLine->new('readline');

while (1) {
  my $command = $term->readline("readline: ");

  if ($command eq 'ping') {
    print "pong\n";
  } elsif ($command eq 'quit') {
    exit;
  }
}