in reply to Win32::Daemon
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. ;-)
|
|---|