Class::Usul::TraitFor::Prompting - Methods for requesting command line input
use Moo; with q(Class::Usul::TraitForPrompting);
Methods that prompt for command line input from the user
Defines no attributes
$key = $self->anykey( $prompt );
Prompt string defaults to 'Press any key to continue...'. Calls and returns prompt. Requires the user to press any key on the keyboard (that generates a character response)
$line = $self->get_line( $question, $default, $quit, $width, $newline );
Prompts the user to enter a single line response to $question which is printed to STDOUT with a program leader. If $quit is true then the options to quit is included in the prompt. If the $width argument is defined then the string is formatted to the specified width which is $width or $self->pwdith or 40. If $newline is true a newline character is appended to the prompt so that the user get a full line of input
$question
$quit
$width
$self->pwdith
$newline
$option = $self->get_option( $question, $default, $quit, $width, $options );
Returns the selected option number from the list of possible options passed in the $question argument
$bool = $self->is_interactive( $optional_filehandle );
Exposes "is_interactive" in IO::Interactive
$self->yorn( $question, $default, $quit, $width );
Prompt the user to respond to a yes or no question. The $question is printed to STDOUT with a program leader. The $default argument is 0|1. If $quit is true then the option to quit is included in the prompt. If the $width argument is defined then the string is formatted to the specified width which is $width or $self->pwdith or 40
$default
0|1
None
There are no known incompatibilities in this module
There are no known bugs in this module. Please report problems to http://rt.cpan.org/NoAuth/Bugs.html?Dist=Class-Usul. Patches are welcome
Larry Wall - For the Perl programming language
Peter Flanigan, <pjfl@cpan.org>
<pjfl@cpan.org>
Copyright (c) 2015 Peter Flanigan. All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic
This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
To install Class::Usul, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::Usul
CPAN shell
perl -MCPAN -e shell install Class::Usul
For more information on module installation, please visit the detailed CPAN module installation guide.