PetaMem has asked for the wisdom of the Perl Monks concerning the following question:
the folowing code snippet is used in one of my applications
and - of course - it works, but - of course - could be better.
The main problem I have with this, is complete lack of editing
functionality not even mentioning gimmicks like expansion or
reverse-search etc. (all nice thingies I´m used from the bash):
cmd_select is just a huge if ... elsif function.CMD: while($exit eq FALSE) { # We´re as long in the lo +op until no exitflag print "> "; $line = <STDIN>; # read input from stdin chop $line; goto CMD if(!$line); # chop CR and if input wa +s empty.. REDO ($key,@param) = split ' ', $line; # split key and parameter +s $exit = &cmd_select($key,@param); }
Now if I happen (and that happens often) to type in something
wrong, I have noch chance of editing it. Instead of Backspace
theres a ^H, instead of "Cursor-Up" theres some ^[OA and so
on.
How - o how my brothers can I get a decent CLI?
Obligatory question: Is there a module? :-)
Ciao
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: crafting a decent CLI
by lshatzer (Friar) on Jul 12, 2001 at 01:42 UTC | |
Re: crafting a decent CLI
by Abigail (Deacon) on Jul 12, 2001 at 02:24 UTC | |
by tye (Sage) on Jul 12, 2001 at 13:32 UTC | |
by Abigail (Deacon) on Jul 12, 2001 at 15:44 UTC | |
by tye (Sage) on Jul 12, 2001 at 23:53 UTC | |
by Abigail (Deacon) on Jul 13, 2001 at 11:49 UTC | |
| |
Re: crafting a decent CLI
by the_slycer (Chaplain) on Jul 12, 2001 at 01:41 UTC | |
by PetaMem (Priest) on Jul 12, 2001 at 14:06 UTC | |
Re: crafting a decent CLI
by synapse0 (Pilgrim) on Jul 12, 2001 at 02:11 UTC |