Stefano Corsi > Quizzer-0.08 > Quizzer::Element::Text::Select

Download:
Quizzer-0.08.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Source  

NAME ^

Quizzer::Element::Text::Select - select from a list of values

DESCRIPTION ^

This lets the user pick from a number of values, using a plain text interface.

METHODS ^

pickabbrevs

This method picks what abbreviations the user should type to select items from a list. When possible, it uses the first letter of a list item as the abbreviation. If two items share a letter, it finds and uses an unused letter instead. If it uses up all letters of the alphabet, it uses numbers for the rest of the abbreviations. It allows you to mark some items as important; it will allocate the best hotkeys to them that it can.

Pass in reference to an array listing the important items, followed by an array of all the items. A hash will be returned, with the items as keys and the abbreviations as values.

expandabbrev

Pass this method what the user entered, followed by the hash returned by pickabbrevs. It will expand the abbreviation they entered and return the choice that corresponds to it. If they entered an invalid abbreviation, it returns false.

syntax highlighting: