hotshot has asked for the wisdom of the Perl Monks concerning the following question:
The above function is suppose to get the array for the tab completion in case 'other thing' happens. if 'something' happens I want to print something and return the prompt with no completion (therefore $atrribs->{completion_word} is set to an empty array).use Term::ReadLine; my $term = new Term::ReadLine 'Command Line Interface'; my $attribs = $term->Attribs; $attribs->{completion_entry_function} = $attribs->{'list_completion_fu +nction'}; $attribs->{attempted_completion_function} = \&tabCompletionFunction; sub tabCompletionFunction { my ($text, $line, $start, $end) = @_; if ($somthing) { &printSomething(); print "\nPrompt> $line"; $attribs->{completion_word} = []; } else { # other thing $attribs->{completion_word} = &getTabCompletionArray($node); # g +et completions array } return $term->completion_matches($text, $attribs->{list_completion_f +unction}); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: problem with tab completion
by pg (Canon) on Dec 12, 2002 at 16:01 UTC | |
by hotshot (Prior) on Dec 12, 2002 at 16:06 UTC | |
by BrowserUk (Patriarch) on Dec 12, 2002 at 16:46 UTC |