gmpassos has asked for the wisdom of the Perl Monks concerning the following question:
Here are the tests:
Test IO::Select:
Test Alarm:use IO::Select ; my $timeout = 5 ; my $stdin = \*STDIN ; my $ios = IO::Select->new( $stdin ) ; for(;;) { my $sel = $ios->can_read($timeout) ; my $buffer ; print "Reading ($timeout\s)...\n" ; 1 while( read( \*STDIN , $buffer, 1 , length($buffer) ) ) ; print "Read:<$buffer>" ; }
Someone has the solution for that?! Since this options are not working!!!my $timeout = 5 ; for(;;) { eval { local $SIG{ALRM} = sub { die "DIE_ALARM\n" } ; alarm $timeout ; my $buffer; print "Reading ($timeout\s)...\n" ; 1 while( read( \*STDIN , $buffer, 1 , length($buffer) ) ) ; print "Read:<$buffer>" ; alarm 0 ; }; if ($@ !~ /DIE_ALARM/s) { die $@ } }
Graciliano M. P.
"The creativity is the expression of the liberty".
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Select on STDIN or ALARM?! For Win32 doesn't work!
by Ionizor (Pilgrim) on Dec 27, 2002 at 18:54 UTC | |
|
•Re: Select on STDIN or ALARM?! For Win32 doesn't work!
by merlyn (Sage) on Dec 27, 2002 at 17:48 UTC | |
|
Re: Select on STDIN or ALARM?! For Win32 doesn't work!
by pg (Canon) on Dec 27, 2002 at 19:10 UTC | |
by gmpassos (Priest) on Dec 27, 2002 at 19:33 UTC | |
by pg (Canon) on Dec 27, 2002 at 21:27 UTC | |
by gmpassos (Priest) on Dec 27, 2002 at 21:44 UTC | |
|
Re: Select on STDIN or ALARM?! For Win32 doesn't work!
by BrowserUk (Patriarch) on Dec 27, 2002 at 18:34 UTC | |
|
why don't you use fork ?
by toss (Novice) on Dec 28, 2002 at 08:23 UTC | |
by toss (Novice) on Dec 28, 2002 at 08:26 UTC |