Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: timeout for ?

by ar0n (Priest)
on Aug 29, 2000 at 13:06 UTC ( #30092=note: print w/replies, xml ) Need Help??


in reply to timeout for ?

From "Advanced Perl Programming":
$SIG{ALRM} = \&timed_out; eval { alarm(10); $buf = <>; alarm(0); }; if ($@ =~ /BLAH/) { print "Timed out."; } sub timed_out { die "BLAH" }
update
this will wait ten seconds for someone to enter something. the alarm(0) is to reset the timer if something does get entered (so &timed_out won't get called).

if you want high resolution timing (like 2.35), ye olde dromedary suggests using syscall to call the system timer routines (itimer).

-- ar0n || Just Another Perl Joe

Replies are listed 'Best First'.
RE: Re: timeout for ?
by tye (Sage) on Aug 29, 2000 at 18:25 UTC

    Ye olde dromedary is old.

    use Time::HiRes;

            - tye (but my friends call me "Tye")

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://30092]
help
Chatterbox?
[Discipulus]: get them all printed on screen
Discipulus ;=)
[shmem]: silly question, silly answer:
[Discipulus]: i know, i know..
[shmem]: man perlfunc |perl -nle '$ok++ if /Alphabetical Listing of Perl Functions/;if($ok ){$s{$1}++if /^ (\w+)/}}{for(keys %s){$f="prototype \\\&CORE::$_"; eval"$f"||delete $CORE::{$_}}print for sort keys%CORE::'
[shmem]: well, there are some builtins which don't have a prototype...
[Discipulus]: eh eh.. i was looking in toke.c but dunno if is already used
[shmem]: oh the whitespace in the regex got condensed, meh
[shmem]: should be /^ {7}(\w+)/ or such
[shmem]: ...at least for my perldoc on Linux debian 8

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (9)
As of 2017-05-23 10:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?