.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.01 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Term::Choose 3pm" .TH Term::Choose 3pm 2024-05-08 "perl v5.38.2" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME Term::Choose \- Choose items from a list interactively. .SH VERSION .IX Header "VERSION" Version 1.765 .SH SYNOPSIS .IX Header "SYNOPSIS" Functional interface: .PP .Vb 1 \& use Term::Choose qw( choose ); \& \& my $array_ref = [ qw( one two three four five ) ]; \& \& my $choice = choose( $array_ref ); # single choice \& print "$choice\en"; \& \& my @choices = choose( [ 1 .. 100 ], { alignment => 1 } ); # multiple choice \& print "@choices\en"; \& \& choose( [ \*(AqPress ENTER to continue\*(Aq ], { prompt => \*(Aq\*(Aq } ); # no choice .Ve .PP Object-oriented interface: .PP .Vb 1 \& use Term::Choose; \& \& my $array_ref = [ qw( one two three four five ) ]; \& \& my $new = Term::Choose\->new(); \& \& my $choice = $new\->choose( $array_ref ); # single choice \& print "$choice\en"; \& \& my @choices = $new\->choose( [ 1 .. 100 ] ); # multiple choice \& print "@choices\en"; \& \& my $stopp = Term::Choose\->new( { prompt => \*(Aq\*(Aq } ); \& $stopp\->choose( [ \*(AqPress ENTER to continue\*(Aq ] ); # no choice .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" Choose interactively from a list of items. .PP \&\f(CW\*(C`Term::Choose\*(C'\fR provides a functional interface ("SUBROUTINES") and an object-oriented interface ("METHODS"). .SH EXPORT .IX Header "EXPORT" Nothing by default. .PP .Vb 1 \& use Term::Choose qw( choose ); .Ve .SH METHODS .IX Header "METHODS" .SS new .IX Subsection "new" .Vb 1 \& $new = Term::Choose\->new( \e%options ); .Ve .PP This constructor returns a new \f(CW\*(C`Term::Choose\*(C'\fR object. .PP To set the different options it can be passed a reference to a hash as an optional argument. .PP For detailed information about the options see "OPTIONS". .SS choose .IX Subsection "choose" The method \f(CW\*(C`choose\*(C'\fR allows the user to choose from a list. .PP The first argument is an array reference which holds the list of the available choices. .PP As a second and optional argument it can be passed a reference to a hash where the keys are the option names and the values the option values. .PP Options set with \f(CW\*(C`choose\*(C'\fR overwrite options set with \f(CW\*(C`new\*(C'\fR. Before leaving \f(CW\*(C`choose\*(C'\fR restores the overwritten options. .PP .Vb 1 \& $choice = $new\->choose( $array_ref, \e%options ); \& \& @choices= $new\->choose( $array_ref, \e%options ); \& \& $new\->choose( $array_ref, \e%options ); .Ve .PP When in the documentation is mentioned "array" or "list" or "elements" or "items" (of the array/list) than these refer to this array passed as a reference as the first argument. .PP For more information how to use \f(CW\*(C`choose\*(C'\fR and its return values see "USAGE AND RETURN VALUES". .SH SUBROUTINES .IX Header "SUBROUTINES" .SS choose .IX Subsection "choose" The function \f(CW\*(C`choose\*(C'\fR allows the user to choose from a list. It takes the same arguments as the method "choose". .PP .Vb 1 \& $choice = choose( $array_ref, \e%options ); \& \& @choices= choose( $array_ref, \e%options ); \& \& choose( $array_ref, \e%options ); .Ve .PP See the "OPTIONS" section for more details about the different options and how to set them. .PP See also the following section "USAGE AND RETURN VALUES". .SH "USAGE AND RETURN VALUES" .IX Header "USAGE AND RETURN VALUES" .IP \(bu 4 If \f(CW\*(C`choose\*(C'\fR is called in a \fIscalar context\fR, the user can choose an item by using the "Keys to move around" and confirming with \f(CW\*(C`Return\*(C'\fR. .Sp \&\f(CW\*(C`choose\*(C'\fR then returns the chosen item. .IP \(bu 4 If \f(CW\*(C`choose\*(C'\fR is called in an \fIlist context\fR, the user can also mark an item with the \f(CW\*(C`SpaceBar\*(C'\fR. .Sp \&\f(CW\*(C`choose\*(C'\fR then returns \- when \f(CW\*(C`Return\*(C'\fR is pressed \- the list of marked items (including the highlighted item if the option \fIinclude_highlighted\fR is set to \f(CW1\fR). .Sp In \fIlist context\fR \f(CW\*(C`Ctrl\-SpaceBar\*(C'\fR (or \f(CW\*(C`Ctrl\-@\*(C'\fR) inverts the choices: marked items are unmarked and unmarked items are marked. .IP \(bu 4 If \f(CW\*(C`choose\*(C'\fR is called in an \fIvoid context\fR, the user can move around but mark nothing; the output shown by \f(CW\*(C`choose\*(C'\fR can be closed with \f(CW\*(C`Return\*(C'\fR. .Sp Called in void context \f(CW\*(C`choose\*(C'\fR returns nothing. .Sp If the first argument refers to an empty array, \f(CW\*(C`choose\*(C'\fR returns nothing. .PP If the items of the list don't fit on the screen, the user can scroll to the next (previous) page(s). .PP If the window size is changed, then as soon as the user enters a keystroke \f(CW\*(C`choose\*(C'\fR rewrites the screen. .PP \&\f(CW\*(C`choose\*(C'\fR returns \f(CW\*(C`undef\*(C'\fR or an empty list in list context if the \f(CW\*(C`q\*(C'\fR key (or \f(CW\*(C`Ctrl\-Q\*(C'\fR) is pressed. .PP If the \fImouse\fR mode is enabled, an item can be chosen with the left mouse key, in list context the right mouse key can be used instead the \f(CW\*(C`SpaceBar\*(C'\fR key. .PP Pressing the \f(CW\*(C`Ctrl\-F\*(C'\fR allows one to enter a regular expression so that only the items that match the regular expression are displayed. When going back to the unfiltered menu (\f(CW\*(C`Enter\*(C'\fR) the item highlighted in the filtered menu keeps the highlighting. Also (in \fIlist context\fR) marked items retain there markings. The Perl function \f(CW\*(C`readline\*(C'\fR is used to read the regular expression if Term::Form::ReadLine is not available. See option \fIsearch\fR. .SS "Keys to move around" .IX Subsection "Keys to move around" .IP \(bu 4 the \f(CW\*(C`Arrow\*(C'\fR keys (or the \f(CW\*(C`h,j,k,l\*(C'\fR keys) to move up and down or to move to the right and to the left, .IP \(bu 4 the \f(CW\*(C`Tab\*(C'\fR key (or \f(CW\*(C`Ctrl\-I\*(C'\fR) to move forward, the \f(CW\*(C`BackSpace\*(C'\fR key (or \f(CW\*(C`Ctrl\-H\*(C'\fR or \f(CW\*(C`Shift\-Tab\*(C'\fR) to move backward, .IP \(bu 4 the \f(CW\*(C`PageUp\*(C'\fR key (or \f(CW\*(C`Ctrl\-P\*(C'\fR) to go to the previous page, the \f(CW\*(C`PageDown\*(C'\fR key (or \f(CW\*(C`Ctrl\-N\*(C'\fR) to go to the next page, .IP \(bu 4 the \f(CW\*(C`Insert\*(C'\fR key to go back 10 pages, the \f(CW\*(C`Delete\*(C'\fR key to go forward 10 pages, .IP \(bu 4 the \f(CW\*(C`Home\*(C'\fR key (or \f(CW\*(C`Ctrl\-A\*(C'\fR) to jump to the beginning of the list, the \f(CW\*(C`End\*(C'\fR key (or \f(CW\*(C`Ctrl\-E\*(C'\fR) to jump to the end of the list. .SS "Modifications for the output" .IX Subsection "Modifications for the output" For the output on the screen the array elements are modified. .PP All the modifications are made on a copy of the original array so \f(CW\*(C`choose\*(C'\fR returns the chosen elements as they were passed to the function without modifications. .PP Modifications: .IP \(bu 4 If an element is not defined the value from the option \fIundef\fR is assigned to the element. .IP \(bu 4 If an element holds an empty string the value from the option \fIempty\fR is assigned to the element. .IP \(bu 4 Tab characters in elements are replaces with a space. .Sp .Vb 1 \& $element =~ s/\et/ /g; .Ve .IP \(bu 4 Vertical spaces in elements are squashed to two spaces. .Sp .Vb 1 \& $element =~ s/\ev+/\e \e /g; .Ve .IP \(bu 4 Code points from the ranges of control, surrogate and noncharacter are removed. .Sp .Vb 1 \& $element =~ s/[\ep{Cc}\ep{Noncharacter_Code_Point}\ep{Cs}]//g; .Ve .IP \(bu 4 If the length of an element is greater than the width of the screen the element is cut and at the end of the string are added three dots. .SH OPTIONS .IX Header "OPTIONS" Options which expect a number as their value expect integers. .PP \fIalignment\fR .IX Subsection "alignment" .PP 0 \- elements ordered in columns are aligned to the left (default) .PP 1 \- elements ordered in columns are aligned to the right .PP 2 \- elements ordered in columns are centered .PP \fIbeep\fR .IX Subsection "beep" .PP 0 \- off (default) .PP 1 \- on .PP \fIclear_screen\fR .IX Subsection "clear_screen" .PP 0 \- off (default) .PP 1 \- clears the screen before printing the choices .PP \fIcodepage_mapping\fR .IX Subsection "codepage_mapping" .PP This option has only meaning if the operating system is MSWin32. .PP If the OS is MSWin32, Win32::Console::ANSI is used. By default \f(CW\*(C`Win32::Console::ANSI\*(C'\fR converts the characters from Windows code page to DOS code page (the so-called ANSI to OEM conversion). This conversation is disabled by default in \&\f(CW\*(C`Term::Choose\*(C'\fR but one can enable it by setting this option. .PP Setting this option to \f(CW1\fR enables the codepage mapping offered by Win32::Console::ANSI. .PP 0 \- disable automatic codepage mapping (default) .PP 1 \- keep automatic codepage mapping .PP \fIcolor\fR .IX Subsection "color" .PP Enable the support for ANSI SGR escape sequences. .PP 0 \- off (default) .PP 1 \- enabled but the current selected element is not colored. .PP 2 \- enabled .PP \fIdefault\fR .IX Subsection "default" .PP With the option \fIdefault\fR it can be selected an element, which will be highlighted as the default instead of the first element. .PP \&\fIdefault\fR expects a zero indexed value, so e.g. to highlight the third element the value would be \fI2\fR. .PP If the passed value is greater than the index of the last array element the first element is highlighted. .PP Allowed values: 0 or greater .PP (default: undefined) .PP \fIempty\fR .IX Subsection "empty" .PP Sets the string displayed on the screen instead an empty string. .PP (default: "") .PP \fIfooter\fR .IX Subsection "footer" .PP Add a string in the bottom line. .PP If a footer string is passed with this option, the option \fIpage\fR is automatically set to \f(CW2\fR. .PP (default: undefined) .PP \fIhide_cursor\fR .IX Subsection "hide_cursor" .PP 0 \- keep the terminals highlighting of the cursor position .PP 1 \- hide the terminals highlighting of the cursor position (default) .PP \fIinfo\fR .IX Subsection "info" .PP Expects as its value a string. The info text is printed above the prompt string. .PP (default: not set) .PP \fIindex\fR .IX Subsection "index" .PP 0 \- off (default) .PP 1 \- return the index of the chosen element instead of the chosen element respective the indices of the chosen elements instead of the chosen elements. .PP \fIkeep\fR .IX Subsection "keep" .PP \&\fIkeep\fR prevents that all the terminal rows are used by the prompt lines. .PP Setting \fIkeep\fR ensures that at least \fIkeep\fR terminal rows are available for printing list rows. .PP If the terminal height is less than \fIkeep\fR \fIkeep\fR is set to the terminal height. .PP Allowed values: 1 or greater .PP (default: 5) .PP \fIlayout\fR .IX Subsection "layout" .IP \(bu 4 0 \- layout off .Sp .Vb 8 \& .\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-. .\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-. .\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-. .\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-. \& | .. .. .. .. .. .. .. | | .. .. .. .. .. .. .. | | .. .. .. .. .. .. .. | | .. .. .. .. .. .. .. | \& | | | .. .. .. .. .. .. .. | | .. .. .. .. .. .. .. | | .. .. .. .. .. .. .. | \& | | | | | .. .. .. .. .. | | .. .. .. .. .. .. .. | \& | | | | | | | .. .. .. .. .. .. .. | \& | | | | | | | .. .. .. .. .. .. .. | \& | | | | | | | .. .. .. .. .. .. .. | \& \*(Aq\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\*(Aq \*(Aq\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\*(Aq \*(Aq\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\*(Aq \*(Aq\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\*(Aq .Ve .IP \(bu 4 1 \- default .Sp .Vb 8 \& .\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-. .\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-. .\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-. .\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-. \& | .. .. .. .. .. .. .. | | .. .. .. .. .. | | .. .. .. .. .. .. | | .. .. .. .. .. .. .. | \& | | | .. .. .. .. .. | | .. .. .. .. .. .. | | .. .. .. .. .. .. .. | \& | | | .. .. | | .. .. .. .. .. .. | | .. .. .. .. .. .. .. | \& | | | | | .. .. .. .. .. .. | | .. .. .. .. .. .. .. | \& | | | | | .. .. .. | | .. .. .. .. .. .. .. | \& | | | | | | | .. .. .. .. .. .. .. | \& \*(Aq\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\*(Aq \*(Aq\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\*(Aq \*(Aq\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\*(Aq \*(Aq\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\*(Aq .Ve .Sp 2 \- all in a single column .Sp .Vb 8 \& .\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-. .\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-. .\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-. .\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-. \& | .. | | .. | | .. | | .. | \& | .. | | .. | | .. | | .. | \& | .. | | .. | | .. | | .. | \& | | | .. | | .. | | .. | \& | | | | | .. | | .. | \& | | | | | | | .. | \& \*(Aq\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\*(Aq \*(Aq\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\*(Aq \*(Aq\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\*(Aq \*(Aq\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\*(Aq .Ve .PP If \fIlayout\fR is set to \f(CW0\fR or \f(CW1\fR and the unformatted list items fit in one row, the list items are placed in one row without column formatting. This behavior can be disabled by setting \fImax_cols\fR. .PP \fIll\fR .IX Subsection "ll" .PP If all elements have the same length, the length can be passed with this option. \f(CW\*(C`choose\*(C'\fR then doesn't calculate the length of the longest element itself but uses the passed value. \fIlength\fR refers here to the number of print columns the element will use on the terminal. .PP If \fIll\fR is set, \f(CW\*(C`choose\*(C'\fR returns always the index(es) of the chosen item(s) regardless of how \fIindex\fR is set. .PP Undefined list elements are not allowed. .PP The replacements described in "Modifications for the output" are not applied. If elements contain unsupported characters the output might break. .PP If \fIll\fR is set to a value less than the length of the elements, the output could break. .PP If \fIll\fR is set and the window size has changed, choose returns immediately \f(CW\-1\fR. .PP Allowed values: 1 or greater .PP (default: undefined) .PP \fImargin\fR .IX Subsection "margin" .PP The option \fImargin\fR allows one to set a margin on all four sides. .PP \&\fImargin\fR expects a reference to an array with four elements in the following order: .PP \&\- top margin (number of terminal lines) .PP \&\- right margin (number of terminal columns) .PP \&\- botton margin (number of terminal lines) .PP \&\- left margin (number of terminal columns) .PP \&\fImargin\fR does not affect the \fIinfo\fR and \fIprompt\fR string. To add margins to the \fIinfo\fR and \fIprompt\fR string see \&\fItabs_info\fR and \fItabs_prompt\fR. .PP Allowed values: 0 or greater. Elements beyond the fourth are ignored. .PP (default: undefined) .PP \fImax_cols\fR .IX Subsection "max_cols" .PP Limit the number of columns to \fImax_cols\fR. .PP \&\fIlayout\fR set to \f(CW2\fR has always one column. .PP Allowed values: 1 or greater .PP (default: undefined) .PP \fImax_height\fR .IX Subsection "max_height" .PP If defined sets the maximal number of rows used for printing list items. .PP If the available height is less than \fImax_height\fR then \fImax_height\fR is set to the available height. .PP Height in this context means print rows. .PP \&\fImax_height\fR overwrites \fIkeep\fR if \fImax_height\fR is set to a value less than \fIkeep\fR. .PP Allowed values: 1 or greater .PP (default: undefined) .PP \fImax_width\fR .IX Subsection "max_width" .PP If defined, sets the maximal output width to \fImax_width\fR if the terminal width is greater than \fImax_width\fR. .PP To prevent the "auto-format" to use a width less than \fImax_width\fR set \fIlayout\fR to \f(CW0\fR. .PP Width refers here to the number of print columns. .PP Allowed values: 1 or greater .PP (default: undefined) .PP \fImouse\fR .IX Subsection "mouse" .PP 0 \- off (default) .PP 1 \- on. Enables the Any-Event-Mouse-Mode (1003) and the Extended-SGR-Mouse-Mode (1006). .PP If the option \fImouse\fR is enabled layers for \f(CW\*(C`STDIN\*(C'\fR are changed. Then before leaving \f(CW\*(C`choose\*(C'\fR as a cleanup \f(CW\*(C`STDIN\*(C'\fR is marked as \f(CW\*(C`UTF\-8\*(C'\fR with \f(CW:encoding(UTF\-8)\fR. This doesn't apply if the OS is MSWin32. .PP If the OS is MSWin32 the mouse is enabled with the help of Win32::Console. .PP \fIorder\fR .IX Subsection "order" .PP If the output has more than one row and more than one column: .PP 0 \- elements are ordered horizontally .PP 1 \- elements are ordered vertically (default) .PP Default may change in a future release. .PP \fIpad\fR .IX Subsection "pad" .PP Sets the number of whitespaces between columns. (default: 2) .PP Allowed values: 0 or greater .PP \fIpage\fR .IX Subsection "page" .PP 0 \- off .PP 1 \- print the page number on the bottom of the screen. If all the choices fit into one page, the page number is not displayed. (default) .PP 2 \- the page number is always displayed even with only one page. Setting \fIpage\fR to \f(CW2\fR automatically enables the option clear_screen. .PP \fIprompt\fR .IX Subsection "prompt" .PP If \fIprompt\fR is undefined, a default prompt-string will be shown. .PP If the \fIprompt\fR value is an empty string (""), no prompt-line will be shown. .PP default in list and scalar context: \f(CW\*(C`Your choice:\*(C'\fR .PP default in void context: \f(CW\*(C`Close with ENTER\*(C'\fR .PP \fIsearch\fR .IX Subsection "search" .PP Set the behavior of \f(CW\*(C`Ctrl\-F\*(C'\fR. .PP 0 \- off .PP 1 \- case-insensitive search (default) .PP 2 \- case-sensitive search .PP \fIskip_items\fR .IX Subsection "skip_items" .PP When navigating through the list, the elements that match the regex pattern passed with this option will be skipped. .PP In list context: these elements cannot be marked. .PP Expected value: a regex quoted with the \f(CW\*(C`qr\*(C'\fR operator. .PP (default: undefined) .PP \fItabs_info\fR .IX Subsection "tabs_info" .PP The option \fItabs_info\fR allows one to insert spaces at the beginning and the end of \fIinfo\fR lines. .PP \&\fItabs_info\fR expects a reference to an array with one to three elements: .PP \&\- the first element (initial tab) sets the number of spaces inserted at beginning of paragraphs .PP \&\- the second element (subsequent tab) sets the number of spaces inserted at the beginning of all broken lines apart from the beginning of paragraphs .PP \&\- the third element sets the number of spaces used as a right margin. .PP Allowed values: 0 or greater. Elements beyond the third are ignored. .PP default: If \fImargin\fR is defined, the initial tab and the subsequent tab are set to left\-\fImargin\fR and the right margin is set to right\-\fImargin\fR. If \fImargin\fR is not defined, the default is undefined. .PP \fItabs_prompt\fR .IX Subsection "tabs_prompt" .PP The option \fItabs_prompt\fR allows one to insert spaces at the beginning and the end of \fIprompt\fR lines. .PP \&\fItabs_prompt\fR expects a reference to an array with one to three elements: .PP \&\- the first element (initial tab) sets the number of spaces inserted at beginning of paragraphs .PP \&\- the second element (subsequent tab) sets the number of spaces inserted at the beginning of all broken lines apart from the beginning of paragraphs .PP \&\- the third element sets the number of spaces used as a right margin. .PP Allowed values: 0 or greater. Elements beyond the third are ignored. .PP default: If \fImargin\fR is defined, the initial tab and the subsequent tab are set to left\-\fImargin\fR and the right margin is set to right\-\fImargin\fR. If \fImargin\fR is not defined, the default is undefined. .PP \fIundef\fR .IX Subsection "undef" .PP Sets the string displayed on the screen instead an undefined element. .PP default: "" .SS "Options List Context" .IX Subsection "Options List Context" \fIinclude_highlighted\fR .IX Subsection "include_highlighted" .PP In list context when \f(CW\*(C`Return\*(C'\fR is pressed .PP 0 \- \f(CW\*(C`choose\*(C'\fR returns the items marked with the \f(CW\*(C`SpaceBar\*(C'\fR. (default) .PP 1 \- \f(CW\*(C`choose\*(C'\fR returns the items marked with the \f(CW\*(C`SpaceBar\*(C'\fR plus the highlighted item. .PP 2 \- \f(CW\*(C`choose\*(C'\fR returns the items marked with the \f(CW\*(C`SpaceBar\*(C'\fR. If no items are marked with the \f(CW\*(C`SpaceBar\*(C'\fR, the highlighted item is returned. .PP \fImark\fR .IX Subsection "mark" .PP \&\fImark\fR expects as its value a reference to an array. The elements of the array are list indexes. \f(CW\*(C`choose\*(C'\fR preselects the list-elements correlating to these indexes. .PP Elements greater than the last index of the list are ignored. .PP This option has only meaning in list context. .PP (default: undefined) .PP \fImeta_items\fR .IX Subsection "meta_items" .PP \&\fImeta_items\fR expects as its value a reference to an array. The elements of the array are list indexes. These elements can not be marked with the \f(CW\*(C`SpaceBar\*(C'\fR or with the right mouse key but if one of these elements is the highlighted item it is added to the chosen items when \f(CW\*(C`Return\*(C'\fR is pressed. .PP Elements greater than the last index of the list are ignored. .PP This option has only meaning in list context. .PP (default: undefined) .PP \fIno_spacebar\fR .IX Subsection "no_spacebar" .PP \&\fIno_spacebar\fR expects as its value a reference to an array. The elements of the array are indexes of the list which should not be markable with the \f(CW\*(C`SpaceBar\*(C'\fR or with the right mouse key. .PP If an element is preselected with the option \fImark\fR and also marked as not selectable with the option \fIno_spacebar\fR, the user can not remove the preselection of this element. .PP \&\fIno_spacebar\fR elements greater than the last index of the list are ignored. .PP This option has only meaning in list context. .PP (default: undefined) .SH "ERROR HANDLING" .IX Header "ERROR HANDLING" .SS croak .IX Subsection "croak" \&\f(CW\*(C`new|choose\*(C'\fR croaks if passed invalid arguments. .SS carp .IX Subsection "carp" If pressing a key results in an undefined value \f(CW\*(C`choose\*(C'\fR carps with \f(CW\*(C`EOT: $!\*(C'\fR and returns \fIundef\fR or an empty list in list context. .SH REQUIREMENTS .IX Header "REQUIREMENTS" .SS "Perl version" .IX Subsection "Perl version" Requires Perl version 5.10.0 or greater. .SS "Optional modules" .IX Subsection "Optional modules" \fITerm::ReadKey\fR .IX Subsection "Term::ReadKey" .PP If Term::ReadKey is available it is used \f(CW\*(C`ReadKey\*(C'\fR to read the user input and \f(CW\*(C`GetTerminalSize\*(C'\fR to get the terminal size. Without \f(CW\*(C`Term::ReadKey\*(C'\fR \f(CW\*(C`getc\*(C'\fR is used to read the input and \f(CW\*(C`stty size\*(C'\fR to get the terminal size. .PP If the OS is MSWin32 it is used Win32::Console to read the user input and to get the terminal size. .SS "Decoded strings" .IX Subsection "Decoded strings" \&\f(CW\*(C`choose\*(C'\fR expects decoded strings as array elements. .SS "Encoding layer for STDOUT" .IX Subsection "Encoding layer for STDOUT" For a correct output it is required an appropriate encoding layer for STDOUT matching the terminal's character set. .SS "Monospaced font" .IX Subsection "Monospaced font" It is required a terminal that uses a monospaced font which supports the printed characters. .SS "Ambiguous width characters" .IX Subsection "Ambiguous width characters" By default ambiguous width characters are treated as half width. If the environment variable \f(CW\*(C`TC_AMBIGUOUS_WIDE\*(C'\fR is set to a true value, ambiguous width characters are treated as full width. .SS "Escape sequences" .IX Subsection "Escape sequences" By default \f(CW\*(C`Term::Choose\*(C'\fR uses \f(CW\*(C`tput\*(C'\fR to get the appropriate escape sequences. If the environment variable \&\f(CW\*(C`TC_ANSI_ESCAPES\*(C'\fR is set to a true value, hardcoded ANSI escape sequences are used directly without calling \f(CW\*(C`tput\*(C'\fR. .PP The escape sequences to enable the \fImouse\fR mode are always hardcoded. .SS "Other environment variables" .IX Subsection "Other environment variables" If the environment variable \f(CW\*(C`TC_RESET_AUTO_UP\*(C'\fR existed when calling \f(CW\*(C`choose\*(C'\fR: \f(CW\*(C`TC_RESET_AUTO_UP\*(C'\fR is set to \f(CW0\fR if the \f(CW\*(C`LINE_FEED\*(C'\fR/\f(CW\*(C`CARRIAGE_RETURN\*(C'\fR key was the only key pressed and \f(CW\*(C`TC_RESET_AUTO_UP\*(C'\fR is set ot \f(CW1\fR if other keys than \f(CW\*(C`LINE_FEED\*(C'\fR/\f(CW\*(C`CARRIAGE_RETURN\*(C'\fR were also pressed. .SS MSWin32 .IX Subsection "MSWin32" If the OS is MSWin32 Win32::Console and Win32::Console::ANSI with ANSI escape sequences are used. See also "codepage_mapping". .SH SUPPORT .IX Header "SUPPORT" You can find documentation for this module with the perldoc command. .PP .Vb 1 \& perldoc Term::Choose .Ve .SH AUTHOR .IX Header "AUTHOR" Matthäus Kiem .SH CREDITS .IX Header "CREDITS" Based on the \f(CW\*(C`choose\*(C'\fR function from the Term::Clui module. .PP Thanks to the Perl\-Community.de and the people form stackoverflow for the help. .SH "LICENSE AND COPYRIGHT" .IX Header "LICENSE AND COPYRIGHT" Copyright (C) 2012\-2024 Matthäus Kiem. .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For details, see the full text of the licenses in the file LICENSE.