NAME

Modwheel::REPL::Prompt - User interaction from the console.

VERSION

This document describes Modwheel version v0.3.1

SYNOPSIS

 use Modwheel::REPL::Prompt;

 my $prompt = Modwheel::REPL::Prompt->new( );

 # Keep asking until user provides a number. 
 my $number = $prompt->number('Please enter a number:');

 # Ask for yes or no, if the user hits enter, yes is the default. 
 my $confirm = $prompt->yes_no('Would you like to start?');

 # Ask for no or yes, if the user hits enter, no is the default. 
 my $confirm = $prompt->no_yes('Would you like to delete this file?');

DESCRIPTION

Modwheel::REPL::Prompt supports password input, auto-completion, suggestions and more.

SUBROUTINES/METHODS

CONSTRUCTOR

Modwheel::REPL::Prompt->new( )

Create a new Modwheel::REPL::Prompt object.

ATTRIBUTES

Modwheel::REPL::Promt->echo =item Modwheel::REPL::Promt->set_echo($bool_on)

Should echo be on or off for user input? the ->password function turns this off temporarily.

METHODS

Modwheel::REPL::Prompt->prompt($question, $default_answer, @suggestions)

Ask user a question. If there are suggestions (default answer is also an suggestion) they will be listed after the question.

Modwheel::REPL::Prompt->password($question)

Ask user for a password. Echo will be turned off. This will loop until a password is entered.

Modwheel::REPL::Prompt->number($question)

Ask user for a number. This will loop until user provides a valid number.

Modwheel::REPL::Prompt->yes_no($question)

Ask user for Yes or No. If user doesn't enter anything Yes is the default.

Modwheel::REPL::Prompt->no_yes($question)

Ask user for No or Yes. If user doesn't enter anything No is the default.

Modwheel::REPL::Prompt->select_from_list($question, @list_of_valid_answers)

Loops until user has answered one of the answers in the list provided.

Modwheel::REPL::Prompt->suggest($question, @suggestion)

Ask for a question, but also give some suggestions.

Modwheel::REPL::Prompt->using_default($question, $default_answer, @opt_suggestions)

Ask a question. If user doesn enter anything, a default answer is used.

PRIVATE METHODS

Modwheel::REPL::Prompt->_yes_no_no_yes($question, $opt_order_yes_first)

Internal method used to implement both yes_no and no_yes.

DIAGNOSTICS

CONFIGURATION AND ENVIRONMENT

This module requires no configuration file or environment variables.

DEPENDENCIES

  • version

  • Term::ReadKey

  • Term::ANSIColor

  • Term::Complete

  • List::MoreUtils

INCOMPATIBILITIES

None known.

BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests to bug-modwheel@rt.cpan.org, or through the web interface at http://rt.cpan.org.

SEE ALSO

VERSION

v0.3.1

AUTHOR

Ask Solem, ask@0x61736b.net.

LICENSE AND COPYRIGHT

Copyright (c), 2007 Ask Solem ask@0x61736b.net.

All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.6 or, at your option, any later version of Perl 5 you may have available.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.