in reply to Keyboard timeout in perl
#!/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"; }; }
|
|---|