Re: Is it possible to impose a timeout on <>?
From: pkent (pkent77tea_at_yahoo.com.tea)
Date: 03/06/04
- Next message: morteza: "learning perl"
- Previous message: pkent: "Re: how to see how many open file descriptors my program has?"
- In reply to: Bob Dubery: "Is it possible to impose a timeout on <>?"
- Next in thread: Bob Dubery: "Re: Is it possible to impose a timeout on <>?"
- Reply: Bob Dubery: "Re: Is it possible to impose a timeout on <>?"
- Reply: Bob Dubery: "Re: Is it possible to impose a timeout on <>?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sat, 06 Mar 2004 11:58:47 +0000
In article <e8f67309.0403050035.4ad523c3@posting.google.com>,
megapode@hotmail.com (Bob Dubery) wrote:
> This is done via HTTP
...
> The program hangs at the <> operator.
>
> OK... a wierd situation and not a common one, but I want to improve
> the code. Specificially when I invoke <> I'd like to be able to impose
> a time out so that if I get nothing back after n seconds I can raise
> an error condition and start interrogating the next site.
Here is some example code:
my $line;
eval {
alarm($alarmtime);
$line = <SOCKET>;
};
alarm 0; # cancel the alarm
if ($@) {
# whatever error handling...
}
There may be better ways that use lower-level reading functions though.
P
-- pkent 77 at yahoo dot, er... what's the last bit, oh yes, com Remove the tea to reply
- Next message: morteza: "learning perl"
- Previous message: pkent: "Re: how to see how many open file descriptors my program has?"
- In reply to: Bob Dubery: "Is it possible to impose a timeout on <>?"
- Next in thread: Bob Dubery: "Re: Is it possible to impose a timeout on <>?"
- Reply: Bob Dubery: "Re: Is it possible to impose a timeout on <>?"
- Reply: Bob Dubery: "Re: Is it possible to impose a timeout on <>?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|