Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Trying out the example from Term::ReadLine's Synopsis:
use Term::ReadLine;
my $term = Term::ReadLine->new('Simple Perl calc');
my $prompt = "Enter your arithmetic expression: ";
my $OUT = $term->OUT || \*STDOUT;
while ( defined ($_ = $term->readline($prompt)) ) {
my $res = eval($_);
warn $@ if $@;
print $OUT $res, "\n" unless $@;
$term->addhistory($_) if /\S/;
}
When I press the Delete key, program ends immediately. Is this how the thing supposed to work? How to avoid this behavior?
(BTW, this only happens with Term::ReadLine::Perl. After I install Term::ReadLine::Gnu, everything is fine).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pressing Delete key ends Term::ReadLine loop
by Athanasius (Archbishop) on May 20, 2014 at 16:10 UTC | |
|
Re: Pressing Delete key ends Term::ReadLine loop
by cord-bin (Friar) on May 20, 2014 at 17:30 UTC | |
|
Re: Pressing Delete key ends Term::ReadLine loop
by zentara (Cardinal) on May 20, 2014 at 17:15 UTC |