repost to whole mail list. 2009/10/22 flw <su2ad...@gmail.com>
> Sorry for my english. I am happy to use code instead of English to > illustrate the problem. > > Please note that my patch contains 2 lines of change: > delete the line 139 of ClientLite.pm.orig, (maybe you have overlooked this > line) > and add line 143 of ClientLite.pm > > Following is test code: > > D:\MoChou>cat bug.pl > sub foo { > # ...... > my $DONE = 0; > eval { > local $SIG{__DIE__}='DEFAULT'; > local $SIG{__WARN__}; > local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required > > # ........... > alarm 3; > # ........ > $DONE = 1; > }; > > if($@) > { > alarm 0; > # ........ > return; > } > } > > foo(); > print +time, "\n"; > sleep(10); > print +time, "\n"; > > D:\MoChou>bug > 1256143484 > Terminating on signal SIGALRM(14) > > D:\MoChou> > > 2009/10/20 Philip Gwyn <li...@artware.qc.ca> > > >> On 15-Oct-2009 flw wrote: >> > Even if there is no defined $@, it also need to alarm(0). >> >> >> Maybe I'm being dense, but I don't see how the eval {} could exit with an >> alarm >> still set but $@ not set. Or is there some magic to alarm() and SIG{ALRM} >> that >> I'm unaware of. >> >> Also, could you write a test case for this? >> >> -Philip >> >> >