> -----Original Message----- > From: Chas Owens [mailto:[EMAIL PROTECTED] > Sent: Friday, June 15, 2007 10:55 AM > To: Bob McConnell > Cc: beginners@perl.org > Subject: Re: Having trouble porting an application to MS-Windows > > On 6/15/07, Bob McConnell <[EMAIL PROTECTED]> wrote: > snip > > eval { > > local $SIG{ALRM} = sub { die > "alarm\n" }; # NB: > > \n required > > alarm $timeout; > > $nread = sysread PORT, $line, 1; > > alarm 0; > > }; > snip > > This transmits the packet, but never comes out of the eval() if it > > doesn't receive a character. Is there anything obvious that > I missed? > snip > > Hmm, that codes looks right. Do the two scripts I sent earlier work?
Yes, both work with the output below. The difference is that both of yours interrupt an empty while loop, but my code is in a sysread() call. The SIGINT I use to kill the process can interrupt the system call, but will the alarm? Or have I found a bug in the ActiveState implementation? Bob McConnell D:\Perl\eg\SIMscript>perl forka.pl Fri Jun 15 11:16:36 2007 timeout Fri Jun 15 11:16:39 2007 D:\Perl\eg\SIMscript>perl forkb.pl parent Fri Jun 15 11:12:57 2007 parent waiting 10 seconds child Fri Jun 15 11:12:57 2007 child waiting 1 seconds timeout child child Fri Jun 15 11:12:58 2007 timeout parent parent Fri Jun 15 11:13:07 2007 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/