The following module was proposed for inclusion in the Module List:
modid: Term::Input
DSLIP: Rdpfg
description: A simple drop-in substitute for <STDIN> that
userid: REEDFISH (Brian Kelly)
chapterid: 8 (User_Interfaces)
communities:
similar:
Term::TransKeys
rationale:
I needed a ridiculously simple function that behaved exactly like
$input=<STDIN> in scripts, that captured user input and and
populated a variable with a resulting string. BUT - I also wanted to
use other KEYS like F1 and DELETE and the RIGHT ARROW and have them
captured and returned. So I really wanted this:
my $prompt='PROMPT : '; ($input,$key)=input($prompt);
... where I could test the variable '$key' for the key that was
used to terminate the input. That way I could use the arrow keys to
scroll a menu for instance.
I looked through the CPAN, and could not find something this simple
and straight-forward. So I wrote it. Enjoy.
NOTE: Backspace is not captured - but used to backspace. DELETE is
captured. Also, no Control combinations are captured - just the
non-standard keys F1-F12, INSERT, DELETE, ESCAPE, HOME, PGDOWN,
PGUP, END and the ARROW KEYS.
enteredby: REEDFISH (Brian Kelly)
enteredon: Sat Jan 15 20:41:33 2011 GMT
The resulting entry would be:
Term::
::Input Rdpfg A simple drop-in substitute for <STDIN> that REEDFISH
Thanks for registering,
--
The PAUSE
PS: The following links are only valid for module list maintainers:
Registration form with editing capabilities:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=f8300000_fab30c6716d08c1d&SUBMIT_pause99_add_mod_preview=1
Immediate (one click) registration:
https://pause.perl.org/pause/authenquery?ACTION=add_mod&USERID=f8300000_fab30c6716d08c1d&SUBMIT_pause99_add_mod_insertit=1
Peek at the current permissions:
https://pause.perl.org/pause/authenquery?pause99_peek_perms_by=me&pause99_peek_perms_query=Term%3A%3AInput