| 1 |
NAME |
| 2 |
IO::Prompt::Tiny - Prompt for user input with a default option |
| 3 |
|
| 4 |
VERSION |
| 5 |
version 0.003 |
| 6 |
|
| 7 |
SYNOPSIS |
| 8 |
use IO::Prompt::Tiny qw/prompt/; |
| 9 |
|
| 10 |
my $answer = prompt("Yes or no? (y/n)", "n"); |
| 11 |
|
| 12 |
DESCRIPTION |
| 13 |
This is an extremely simple prompting module, based on the extremely |
| 14 |
simple prompt offered by ExtUtils::MakeMaker.In many cases, that's all |
| 15 |
you need and this module gives it to you without all the overhead of |
| 16 |
ExtUtils::MakeMaker just to prompt for input. |
| 17 |
|
| 18 |
It doesn't do any validation, coloring, menus, timeouts, or any of the |
| 19 |
wild, crazy, cool stuff that other prompting modules do. It just prompts |
| 20 |
with a default. That's it! |
| 21 |
|
| 22 |
USAGE |
| 23 |
The following function may be explicitly imported. No functions are |
| 24 |
imported by default. |
| 25 |
|
| 26 |
prompt |
| 27 |
my $value = prompt($message); |
| 28 |
my $value = prompt($message, $default); |
| 29 |
|
| 30 |
The prompt() function displays the message as a prompt for input and |
| 31 |
returns the (chomped) response from the user, or the default if the |
| 32 |
response was empty. |
| 33 |
|
| 34 |
If the program is not running interactively or if the |
| 35 |
PERL_MM_USE_DEFAULT environment variable is set to true, the default |
| 36 |
will be used without prompting. |
| 37 |
|
| 38 |
If no default is provided, an empty string will be used instead. |
| 39 |
|
| 40 |
Unlike ExtUtils::MakeMaker::prompt(), this prompt() does not use |
| 41 |
prototypes, so this will work as expected: |
| 42 |
|
| 43 |
my @args = ($prompt, $default); |
| 44 |
prompt(@args); |
| 45 |
|
| 46 |
ENVIRONMENT |
| 47 |
PERL_MM_USE_DEFAULT |
| 48 |
If set to a true value, IO::Prompt::Tiny will always return the default |
| 49 |
without waiting for user input, just like ExtUtils::MakeMaker does. |
| 50 |
|
| 51 |
ACKNOWLEDGMENTS |
| 52 |
The guts of this module are based on ExtUtils::MakeMaker and |
| 53 |
IO::Interactive::Tiny (which is based on IO::Interactive). Thank you to |
| 54 |
the authors of those modules. |
| 55 |
|
| 56 |
SEE ALSO |
| 57 |
* IO::Prompt |
| 58 |
|
| 59 |
* IO::Prompt::Simple |
| 60 |
|
| 61 |
* Prompt::Timeout |
| 62 |
|
| 63 |
* Term::Prompt |
| 64 |
|
| 65 |
SUPPORT |
| 66 |
Bugs / Feature Requests |
| 67 |
Please report any bugs or feature requests through the issue tracker at |
| 68 |
<https://github.com/dagolden/IO-Prompt-Tiny/issues>. You will be |
| 69 |
notified automatically of any progress on your issue. |
| 70 |
|
| 71 |
Source Code |
| 72 |
This is open source software. The code repository is available for |
| 73 |
public review and contribution under the terms of the license. |
| 74 |
|
| 75 |
<https://github.com/dagolden/IO-Prompt-Tiny> |
| 76 |
|
| 77 |
git clone https://github.com/dagolden/IO-Prompt-Tiny.git |
| 78 |
|
| 79 |
AUTHOR |
| 80 |
David Golden <[email protected]> |
| 81 |
|
| 82 |
COPYRIGHT AND LICENSE |
| 83 |
This software is Copyright (c) 2012 by David Golden. |
| 84 |
|
| 85 |
This is free software, licensed under: |
| 86 |
|
| 87 |
The Apache License, Version 2.0, January 2004 |
| 88 |
|