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