We have a defect tracking database which runs on NT. We needed to be able to connect to this database from our Linux CVS server.

Just last week, I created an NT Service with Win32::Daemon. Using DBI and DBD::ODBC, I connect to the defect database. Using RPC.pm (from Sririam's Advanced Perl Programming), I listen on a port for clients. Whenever developers commit files to the repository, perl scripts update the defect database, via RPC.pm. Works like a charm!


I had never created an NT service before, and found the process a little bit un-forgiving. If there was an error in my script, and the Service Control Manager (SCM) could not start the service, it would respond with things like Error 2816. Not very helpful.

It turned out my problem was related to one of my own modules, installed in d:/code/perl/. I traditionally use PERL5LIB (as a user env. variable) to let Perl know where this module resides. Hence, when I tested my perl service from a command prompt (while logged in as myself) it worked like a charm.

However, I was installing my perl service with no user specified, as you were in your tests. My PERL5LIB was not being set, so Perl didn't know where to find my module. The script died, and after the SCM timed out, it said 'Error 2186.' I wasted hours trying to diagnose this.

Once I finally figured out my bone-headed mistake, I moved my module to a directory in the default @INC.

On a related note, my ODBC Data Source was originally configured as a User DSN. Because my service was installed without a user specified... Error 2140. Once I changed my data source to a System DSN, my perl daemon was able to connect to the database.

Now that I've got my NT Service running, I plan to use Win32::Daemon for absolutely everything. ;-)


In reply to Re: Win32::Daemon by donaldm314
in thread Win32::Daemon by Macphisto

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.