Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I schedule a task in Perl?

Does anyone knows if perl supports a task scheduler?

I am working on a c# program that controls a bunch of perl scripts. The perl script talked to some device over the socket interface. The device, "target" , is a embedded system device that require real time interaction.

One of the requirements I need to fulfill is that when I receive message "A" from the device, I need to schedule an event that is going to happen in 15 miliseconds in the future. This event is going to send the message to UT. We call it "B" here. The delay function wouldn't work here because other messages shouldn't be blocked because of Message "B". Sometimes, I also need to send Message "B" every 15 miliseconds.

or Maybe Perl is not a good choice here.

Thanks

like image 676
alex Avatar asked Dec 14 '22 01:12

alex


1 Answers

There are several event-driven non-blocking frameworks available for Perl. Any one of them should be able to do what you need. Here are three examples to get you started: POE, AnyEvent, and IO::Async. That said, if you timing constraints are rigorous ("15 milliseconds on the nose, every time"), then a real-time-scheduled program in a lower-level language like C is probably more appropriate.

like image 60
John Siracusa Avatar answered Jan 05 '23 00:01

John Siracusa