Book HomeJava and XSLTSearch this book

8.197. Term::Complete

Provides word completion on list of words in a specified array. Exports one function.

Complete

Complete ('prompt_string', array)

Sends string to the currently selected filehandle, reads the user's response, and returns the response. Takes the following arguments:

prompt_string
The prompt for user input

array
The array of words against which the user's input is matched

If any of the following characters are included in the user's response to prompt_string, they are treated as special characters:

Tab
Does word completion, matching what the user has typed so far against the list of strings in completion_list. On a unique match, outputs the rest of the matched string and waits for the user to press Return. Otherwise, leaves partial input unchanged and sounds the bell.

Ctrl-D
Prints all possible completions of the user's partial input, or the entire completion list if the partial input string is null, and reissues the prompt string and the partial input. Redefine by setting the variable $Term::Complete::complete.

Ctrl-U
Erases any partial input. Redefine by setting the variable $Term::Complete::kill.

Del, BS
Delete and backspace characters; both erase one character from the partial input string. Redefine by setting the variables $Term::Complete::erase1 and $Term::Complete::erase2.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.