Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

RE: Using Alarm to Handle Timing

by awwaiid (Friar)
on Jul 21, 2000 at 00:57 UTC ( #23486=note: print w/replies, xml ) Need Help??


in reply to Using Alarm to Handle Timing

It looks and works perfectly as far as I can tell. Its a bit hard-wired with that 5 seconds... but as a demo it works great :)

Is it possible to say $SIG{ALRM} = \&wake_up(5) by chance?

--awwaiid

Replies are listed 'Best First'.
RE: RE: Using Alarm to Handle Timing
by merlyn (Sage) on Jul 21, 2000 at 07:53 UTC
    Is it possible to say $SIG{ALRM} = \&wake_up(5) by chance?
    No. But you can pass a parameter by creating an anonymous subroutine:
    $SIG{MUND} = sub { &wakeup(5) };

    -- Randal L. Schwartz, Perl hacker

(chromatic) RE: RE: Using Alarm to Handle Timing
by chromatic (Archbishop) on Jul 21, 2000 at 01:05 UTC
    I'd considered making a global or package variable $timeout. It would be in scope for both the initialization and the signal handler.

    What I'm trying to do is manage my Jellybean objects better. Some of them need to flush their caches every few minutes while others ought to sync data to storage every now and then. Using an internal cron-like feature seems to be pretty elegant, but I don't want to segfault randomly if it's avoidable.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://23486]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (None)
    As of 2021-10-16 16:10 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?
      My first memorable Perl project was:







      Results (69 votes). Check out past polls.

      Notices?