The result is the same andrew ! did u tried that snippet ? i'm just running it , and noticed no changes . could it be perl versions ? i'm in perl 5.0.8
Saber. ----- Original Message ----- From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, June 25, 2003 11:20 AM Subject: RE: Timout using eval You just have to re-order things a bit I think, and remove the local: $SIG{ALRM}= sub {die "TIMEOUT_PASSED\n"}; eval { alarm (3); printf " get character \n" ; $data = <> ; }; # eval the eval block should take less 3 secs otherwise , timeout function is fired alarm (0); if ($@ =~ /TIMEOUT_PASSED/) { # treat timeout printf " TIMEOUT : no data to read \n" ; } -----Original Message----- From: saber zrelli [mailto:[EMAIL PROTECTED] Sent: 25 June 2003 09:32 To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Timout using eval Hi , I'm trying to timeout an event , i'm searching for an implementation to perform that , i tried the eval die technique , but the result is not what i need , this is a sample code : ------------------------------- my$data; eval { local $SIG{ALRM}= sub {die "TIMEOUT_PASSED\n"}; alarm (3); printf " get character \n" ; $data = <> ; alarm (0); }; # eval the eval block should take less 3 secs otherwise , timeout function is fired if ($@ =~ /TIMEOUT_PASSED/) { # treat timeout printf " TIMEOUT : no data to read \n" ; } ------------------------------- the above code , did not wait 3 secs for the user input , it waits forever ! Could someone help please. Thks. ----------------------------------- Saber ZRELLI STMicroelectronics Aplication Engineer Tunis VQT Team. Office 126 Personal Phone +216 22552432 bޮYsSX'X-SzeSlzrدy+Z((tm):.z>mmY-+-bjoeoj)fj> This message is for the named person's use only. It may contain sensitive and private proprietary or legally privileged information. No confidentiality or privilege is waived or lost by any mistransmission. If you are not the intended recipient, please immediately delete it and all copies of it from your system, destroy any hard copies of it and notify the sender. You must not, directly or indirectly, use, disclose, distribute, print, or copy any part of this message if you are not the intended recipient. CREDIT SUISSE GROUP and each legal entity in the CREDIT SUISSE FIRST BOSTON or CREDIT SUISSE ASSET MANAGEMENT business units of CREDIT SUISSE FIRST BOSTON reserve the right to monitor all e-mail communications through its networks. Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. Unless otherwise stated, any pricing information given in this message is indicative only, is subject to change and does not constitute an offer to deal at any price quoted. Any reference to the terms of executed transactions should be treated as preliminary only and subject to our formal written confirmation. _______________________________________________ ActivePerl mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs zV}Rǫf)+-=Z)Kb+J֭y&Nrzmlzrدy+Z(Y