Take a look at perlman:perlipc with particular reference to the Named-pipe or Unix-Domain TCP Clients and Servers for some simple client and server code samples. A bit further down there is a section on UDP: Message Passing, which would be ideal for your application.
You could also read the IO::Sockets documentation.
Essentially, your current cron job script would need to open a socket using the UDP protocol on localhost:someport, (where someport is probably >1024.)
This would take the place of opening the file in your current script.
You would then wrap an endless loop around the processing code in your current script and before where you are currently reading from a file you would block waiting for input. When the input arrives, read it, process it and loop back to listen again.
Where you existing cgi script open and writes to the file, you would connect to localhost:someport (udp), send() the data and close the port.
I don't recall seeing a UDP server example in perlman:perlipc but its not very different to the TCP server. Maybe there is a good example in IO::Socket docs.
In reply to Re: Re: Re: Script run as a Cron Job
by BrowserUk
in thread Script run as a Cron Job
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |