in reply to Running subroutines at specific times

You can either try the Event module, or use a threaded app where the subs loop continuously with sleeps of the appropriate duration.

Remember: There's always one more bug.
  • Comment on Re: Running subroutines at specific times

Replies are listed 'Best First'.
Re^2: Running subroutines at specific times
by stellagoddc (Novice) on Apr 20, 2006 at 17:20 UTC
    Thanks, let me add a little more detail.

    I currently have a script which fires of a load of threads, to do SNMP polls on particular devices, each poll getting its own thread. I dont want to have a thread per device constantly running, especially if all its doing is sleeping.

    So I suppose what I'm after is the ability to fire the same routine of (as a thread) every 20 seconds for device A, every 30 seconds for device B etc.

    I was planning on reading in the device -> polling rate realtionship from a file. So it has to be a little dynamic.

      Thanks, let me add a little more detail.

      Whatever the details may be, you already explained them in this post of which this one is a dupe, which is the reason why I and apparently others downvoted it. Regardless of the details, it seems to me that people supplied enough input already, are you having problems with any of these suggestions? I see that saintmike supplied a complete example, and BrowserUk suggested another approach, which should be more near to your original attempts. If you're having any specific problem with those suggestions, feel free to ask for further clarification...