File: rlbasic

package info (click to toggle)
libterm-readline-gnu-perl 1.47-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,148 kB
  • sloc: perl: 2,191; makefile: 10
file content (23 lines) | stat: -rwxr-xr-x 415 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env perl
#
# rlbasic: A basic readline() loop example
#
#   Copyright (C) 2024 Hiroo Hayashi
#
# Derived from: examples/rlbasic.c in the GNU Readline Library

use strict;
use warnings;
use Term::ReadLine;

my $t = new Term::ReadLine 'rlbasic';

while (1) {
    my $input = $t->readline('');
    last unless defined $input;
    print("$input\n");
    if ($input eq 'exit') {
        last;
    }
}
exit 0;