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



Annotate this POD

View/Report Bugs


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


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



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.


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: