I have a Perl program with a simple command line interface where the
user can enter commands.
I read these commands in a loop that looks like:
while($rc == 0) {
print "$LCLdebuggerPrompt";
$debugCommand = <STDIN>;
chop $debugCommand; # remove trailing newline
$rc = handleCmd($debugCommand);
}
I'd like to be able to add 2 things to this process:
1) protect the command prompt field, so that using the "backspace" or
"left arrow" keys don't move the cursor into the command prompt field.
2) add a "command retrieve" function, so that the "up arrow" and "down
arrow" keys display commands kept in a list of previously stored
commands.
Neither the "protect command prompt" or "up arrow" functions works in
the above example, because I'm missing a more elaborate method for
sampling keyboard input than a read to <STDIN> provides.
Short of learning Perl-curses or writing a full-blown TK-Perl app, are
there any simple techniques - (read: minimum learning time) that I can
use to implement a "protect command prompt" or "retrieve up-arrow key
indication" function?
thanks in advance for any suggestions,
Gavin Bowlby