Name
Class::Usul::TraitFor::Prompting - Methods for requesting command line input
Synopsis
use Moo;
with q(Class::Usul::TraitForPrompting);
Description
Methods that prompt for command line input from the user
Configuration and Environment
Defines no attributes
Subroutines/Methods
anykey
$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)
get_line
$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
get_option
$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
is_interactive
$bool = $self->is_interactive( $optional_filehandle );
Exposes "is_interactive" in IO::Interactive
yorn
$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
Diagnostics
None
Dependencies
Incompatibilities
There are no known incompatibilities in this module
Bugs and Limitations
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
Acknowledgements
Larry Wall - For the Perl programming language
Author
Peter Flanigan, <pjfl@cpan.org>
License and Copyright
Copyright (c) 2018 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