On Tue, Mar 07, 2000 at 04:10:26PM -0600, Robert Canary wrote:
| I have script here as follows:
| 
| --<create Lock file code is here>--
| 
| open (PORTACCESS, "+>>/dev/ttyC0");
| print PORTACCESS "AT\&V1" . "\n\r";
| 
| alarm(10);
| while (<PORTACCESS>) {
|     print;
|     chomp;
|     /OK|ERROR/ && do {
|         close(PORTACCESS);
|         last;
|     };
| }
| 
| 
| The code works fine, except if the modem never responds the code seems
| to get stuck at "while(<PORTACCESS>)", and strangley enough the
| alarm(10) never kicks it out.

Maybe you have restartable system calls screwing things up for you.

Ideas:

1: Try using sysread() instead of <>.
2: Write an alarm handler:
        $SIG{ALRM}=sub { die "SIGALRM received!" }
   Not so nice if you want to recover, of course...
3: Check out the expect module.

Cheers,
--
Cameron Simpson, DoD#743        [EMAIL PROTECTED]    http://www.zip.com.au/~cs/

My favorite recently spotted T-shirt: "U.S. Marines: When it absolutely
positively has to be destroyed overnight."
        - [EMAIL PROTECTED] (Avoid normal situations.)


-- 
To unsubscribe: mail [EMAIL PROTECTED] with "unsubscribe"
as the Subject.

Reply via email to