Prompt::Timeout - prompt() with auto-selecting default value in case of inactivity


Prompt-Timeout documentation  | view source Contained in the Prompt-Timeout distribution.

Index


NAME

Top

Prompt::Timeout - prompt() with auto-selecting default value in case of inactivity

SYNOPSIS

Top

 use Prompt::Timeout;
 my $res = prompt ( $question, $default, $timeout );

DESCRIPTION

Top

This module provides only one function, prompt(), and it's exported by default.

prompt

 my $res = prompt ( $question, $default, $timeout );

Prints a $question and waits for the input. If no keys are pressed during $timeout seconds, $default is assumed. When pressing just Enter key, $default is assumed. If prompt() detects that it is not running interactively, $default will be used without prompting too.

If you want to disable inactivity timer if any key is pressed during prompt(), you can invoke it with another optional parameter:

 my $res = prompt ( $question, $default, $timeout, 1 );

Once a key is pressed, inactivity timer is disabled.

When $timeout value is omitted, it assumes 60 seconds.

AUTHOR

Top

Serguei Trouchelle <stro@railways.dp.ua>

Prompt::Timeout uses partial code from ExtUtils::MakeMaker module.

COPYRIGHT

Top


Prompt-Timeout documentation  | view source Contained in the Prompt-Timeout distribution.