Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
I am using PerlSvc from ActiveState to write an NT Service. To use PerlSvc, the code is wrapped in a package with the main loop inside a while loop (see below).
That is not a problem. The problem arises in that while the loop is sleeping, it can not be interrupted (i.e. In UNIX I can trap a signal and exit, awake, etc). Under NT (using PerlSvc), I've not found a way to do this. When a user goes to Stop the NT Service from the Services Menu, it hangs until the Stop times out or the loop wakes up and checks ContinueRun(). In the past I've had a $Asleep variable and check it when coming into the while loop. If it is true, I sleep 20 more seconds; if it is false, I run the real code and then set it to true. I do this until I've slept X amount (defined by the user). The problem I am now having is that I want the NT Service to be a SOAP server (using SOAP::Lite). If you recall, to start a SOAP::Lite daemon listening you run $daemon->handle(). This gives control to the SOAP::Lite module. Oops! How can I check the ContinueRun() function that let's me listen for NT telling me to stop? Is there a way (aside from modifying SOAP::Lite) to check ConitnueRun()? I've considered using POE and making the code ACT threaded, but that seems like a big undertaking just to check a function. Your thoughts are GREATLY appreciated, Casey In reply to SOAP in an NT Service by cmilfo
|
|