Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: Using Tab Completion on Windows in cmd.exe

by Anonymous Monk
on Nov 26, 2011 at 05:40 UTC ( #940159=note: print w/ replies, xml ) Need Help??


in reply to Re: Using Tab Completion on Windows in cmd.exe
in thread Using Tab Completion on Windows in cmd.exe

Hmm, unsetting term=dumb doesn't work for me on winxp, which windows do you have?


Comment on Re^2: Using Tab Completion on Windows in cmd.exe
Re^3: Using Tab Completion on Windows in cmd.exe
by Stamm (Acolyte) on Nov 26, 2011 at 11:14 UTC
    I'm using Windows 7. I think you must have Term::ReadLine::Perl installed. Otherwise, Term::ReadLine::Stub will be used, which doesn't do word completion.

      Yeah, I got that, I have it

      $ perl -MTerm::ReadLine -MTerm::ReadLine::Perl -d:Modlist -e 1 Carp 1.23 Exporter 5.65 Term::ReadLine 1.07 Term::ReadLine::Perl 1.0303 warnings 1.12

      perl -d:Modlist -e "  use Term::Complete; $|=1; warn $input = Complete( q[ type or tab  ] , [ qw[ ro sham bo foo bar baz ] ] ); "
      doesn't work for me

      update: of course, it doesn't use Term::Readline, duh ...

      So, what are you using, and how (short example please)?

        You're right, it doesn't work with Term::Complete. I thought I had tested it. As you said, it doesn't even use Term::ReadLine.

        It works with Term::Shell. Here with the pod example slightly modified:
        package MyShell; $ENV{TERM} = ''; use base qw(Term::Shell); sub run_command1 { print "command 1!\n"; } sub smry_command1 { "what does command1 do?" } sub help_command1 { "Help on 'command1', whatever that may be..." } sub run_command2 { print "command 2!\n"; } package main; my $shell = MyShell->new; $shell->cmdloop;

        Or directly with Term::ReadLine:
        use Term::ReadLine; $ENV{TERM} = ''; my $term = Term::ReadLine->new('Tab Completion'); my $prompt = ">>> "; &readline::rl_basic_commands( qw(set quit type test run exit) ); while ( defined ( $_ = $term->readline($prompt) ) ) { exit if /exit/ or /quit/; print $_, "\n"; }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://940159]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2014-07-31 06:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (245 votes), past polls