It may be a simple question for a perl expert -
I am trying to run a script which should logically do this>
Main
{
While (true)
Call Sub A
Call Sub B
Call Sub C
}
Sub A
{
Go execute a method A for whatever it needs to do ---
before next time method A runs it need to wait atleast 60 seconds but i still want to call method B in these 60 seconds.
}
Sub B
{
Go execute a method B for whatever it needs to do ---
before next time method b runs it need to wait atleast 60 seconds but i still want to call method C in these 60 seconds in mean time.
}
Sub C
{
Go execute a method C for whatever it needs to do ---
before next time method C runs it need to wait atleast 60 seconds at this moment control should be back in Main and wait for first 60 seconds of A to expire so that Sub A can be called
}
My question: Q: what is best and optimized way can i do this -?
Q: If i put sleep 60 in each sub then next sub will not be called even till 60 seconds expire and it will delay overall processing.
Q: I want 3 subs called every 60 seconds in a sequential order
Q Lastly if i need to call 2 subs in every 60 seconds and last sub every hour - how do i do it?
Comment - my thought was to take UTC as a variable and store it in a variable and keep checking time if time expires than call individual subs but not sure if it optimum way of running code.