The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Build Status

NAME

IO::Prompt::Simple - provide a simple user input

SYNOPSIS

# foo.pl
use IO::Prompt::Simple;

my $answer = prompt 'some question...';
print "answer: $answer\n";

# display prompt message, and wait your input.
$ foo.pl
some question: foo[Enter]
answer: foo

DESCRIPTION

IO::Prompt::Simple is porting ExtUtils::MakeMaker's prompt() function.

Added a few more useful features.

THIS MODULE IS ALPHA LEVEL INTERFACE!!

FUNCTIONS

prompt($message, [$default_or_option])

Display prompt message and wait your input.

$answer = prompt $message;

Sets default value:

$answer = prompt 'sets default', 'default';
is $answer, 'default';

or

$answer = prompt 'sets default', { default => 'default' };
is $answer, 'default';

Display like are:

sets default [default]: [Enter]
...

supported options are:

NOTE

If prompt() detects that it is not running interactively and there is nothing on $input or if the $ENV{PERL_IOPS_USE_DEFAULT} is set to true or use_default option is set to true, the $default will be used without prompting.

This prevents automated processes from blocking on user input.

AUTHOR

xaicron <xaicron {at} gmail.com>

COPYRIGHT

Copyright (C) 2011 Yuji Shimada (@xaicron).

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

ExtUtils::MakeMaker IO::Prompt