The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Term::Choose_HAE - Choose items from a list interactively.

VERSION

Version 0.050

SYNOPSIS

Functional interface:

    use Term::Choose_HAE qw( choose );
    use Term::ANSIColor;

    my $array_ref = [
        colored( 'red_string', 'red'),
        colored( 'green_string', 'green'),
        colored( 'blue_string', 'cyan'),
    ];

    my $choice = choose( $array_ref );                            # single choice
    print "$choice\n";

    my @choices = choose( [ 1 .. 100 ], { justify => 1 } );       # multiple choice
    print "@choices\n";

    choose( [ 'Press ENTER to continue' ], { prompt => '' } );    # no choice

Object-oriented interface:

    use Term::Choose_HAE;
    use Term::ANSIColor;

    my $array_ref = [
        colored( 'red_string', 'red'),
        colored( 'green_string', 'green'),
        colored( 'blue_string', 'cyan'),
    ];

    my $new = Term::Choose_HAE->new();

    my $choice = $new->choose( $array_ref );                       # single choice
    print "$choice\n";

    $new->config( { justify => 1 } );
    my @choices = $new->choose( [ 1 .. 100 ] );                    # multiple choice
    print "@choices\n";

    my $stopp = Term::Choose_HAE->new( { prompt => '' } );
    $stopp->choose( [ 'Press ENTER to continue' ] );               # no choice

DESCRIPTION

Choose interactively from a list of items.

Term::Choose_HAE works like Term::Choose except that choose from Term::Choose_HAE does not disable ANSI escape sequences; so with Term::Choose_HAE it is possible to output colored text. On a MSWin32 OS Win32::Console::ANSI is used to translate the ANSI escape sequences. Term::Choose_HAE provides one additional option: fill_up.

Else see Term::Choose for usage and options.

Occupied escape sequences

choose uses the "inverse" escape sequence to mark the cursor position and the "underline" and "bold" escape sequences to mark the selected items in list context.

OPTIONS

Term::Choose_HAE inherits the options from Term::Choose and adds the option fill_up:

fill_up

0 - off

1 - fill up selected items with the adjacent color. (default)

2 - fill up selected items with the default color.

If fill_up is enabled, the highlighting of the cursor position and in list context the highlighting of the selected items has always the width of the column.

  • fill_up set to 1: the color of the highlighting of leading and trailings spaces is set to the color of the highlighting of the adjacent non-space character of the item if these spaces are not embedded in escape sequences.

  • fill_up set to 2: leading and trailings spaces are highlighted with the default color for highlighting if these spaces are not embedded in escape sequences.

If fill_up is disabled, leading and trailing spaces are not highlighted if they are not embedded in escape sequences.

REQUIREMENTS

The requirements are the same as with Term::Choose except that the minimum Perl version for Term::Choose_HAE is 5.10.1 instead of 5.8.3.

Perl version

Requires Perl version 5.10.1 or greater.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Term::Choose_HAE

AUTHOR

Matthäus Kiem <cuer2s@gmail.com>

CREDITS

Based on a patch for Term::Choose from Stephan Sachse.

Thanks to the Perl-Community.de and the people form stackoverflow for the help.

LICENSE AND COPYRIGHT

Copyright (C) 2015-2016 Matthäus Kiem.

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.