Beefy Boxes and Bandwidth Generously Provided by pair Networks
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).
while (ContinueRun()) { # your loop code here # sleep }
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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-03-28 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found