in reply to Keyboard timeout in perl

I used Time::Out for the following example. It'll prompt for a command, but don't enter one. It'll come back with "Operation timed-out". If you enter a command, it'll return "Done".
#!/usr/bin/perl use strict; no warnings 'redefine'; use ExtUtils::MakeMaker qw(prompt); use Time::Out qw(timeout); use Time::HiRes qw(alarm); test("Done\n"); if ($@) { print "Operation timed-out\n"; } sub test { timeout 20.37, @_ => sub { prompt("Please enter command: "); print "$_[0]\n"; }; }