Hi,

I'm new to perl and I'm trying to write a simple
program that will take commands from user.  I would
like to provide command completion.

Currently I have:

use Term::ReadLine;
use  Term::Complete;

while (true)
{
    $mainTerm = Term::ReadLine->new("Top Level");
    $OUT = $mainTerm->OUT || *STDOUT;

    # read command from user
    $cmd = $mainTerm->readline ('client> ');
    print $cmds{$cmd};

}

I see that it already provides history which is cool! 
Let's say I have the following commands available at
this level - help, exit, do-one, do-two.  How do I add
this to the program so that when use types h<tab> it
completes help and when user doesn't type anything and
hits <tab> or <ctrl-D> it shows the possible
completions.  Any response is appreciated :)

Also, can I modify it so that it will take these
commands from a file or the stdin.  I can have an
option in commandline for reading from file (say, -f
<fn>).  I know how to do the commandline arguments,
etc.

thanks,
manish


                
_______________________________
Do you Yahoo!?
Shop for Back-to-School deals on Yahoo! Shopping.
http://shopping.yahoo.com/backtoschool

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to