Chris Nandor <pudge@pobox.com> writes: >At 12.55 -0500 1998.06.04, John Gilmore-Baldwin wrote: >>#!perl -wl >>use CGI qw(:all); >>$SIG{ALRM} = \&do_die; >>print header('text/plain'); >>alarm(5); >>foreach(0..99){print;sleep(1)} >>sub do_die {print "Time's up!";exit} >> >>This returns to me after 5 seconds, instead of 100: > >Of course it returns after 5 seconds. You set alarm(5). I am not sure I >understand. Maybe you expected it to return after 5 seconds; I do. Presumably, John wanted to demonstrate the difference between a program where alarm works as expected and his connect example where it didn't work. >As to the signal being unreliable, that is a function of virtually all >signals in Perl, I think. When Perl is out doing socket operations, it is >possible (I think) for a SIGALRM to not report as it should, just as cmd-. >does not always work during such operations. - In "perl" as such, alarm() should work. - If it doesn't work with some functions in MacPerl, it's either because of a bug or because in that call, I saw no safe opportunity to cancel the call. - At the moment, I don't know which of these cases applies to connect(), nor do I really care, because the GUSI 2 rewrite should take care of that. Matthias -- Matthias Neeracher <neeri@iis.ee.ethz.ch> http://www.iis.ee.ethz.ch/~neeri "I'm set free to find a new illusion" -- Velvet Underground ***** Want to unsubscribe from this list? ***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch