in reply to Re: (tye)Re: Win32::Daemon
in thread Win32::Daemon

Well, there are obvious things like not having a D: drive... But anything that would cause that open to fail would give that symptom, for example, perhaps the credentials of the service don't have access to append to that file (for example, if D: is a remote file system, then the service probably won't have any access to it no matter what permissions you set on the file).

Or perhaps you were looking at the file using a tool that opened the file w/o specifying shared access so that the daemon couldn't open it.

I'd first check that the script manages to write to the daemon.err file when run not as a service as well as when run as a service with the "user Blarfle;" line commented out. That should narrow things down quite a bit.

You could also use try other methods for getting the "invisible error" to not be invisible such as:

open(...) or system( "net send %computername% " . qq("Can't open d:/daemon.err: $!; $^E") );
(though I don't think that will work from a service either) or using something to pop up a message box (this should work if you configure the service to have access to the interactive desktop).

It is sad that the WinNT Service Manager is so stupid when it comes to noticing and reporting that the service that it started has died. But then, if you look very far into the design of the service manager (called "the SCuM"), you quickly realize that it isn't a very good design in a lot of ways (just ask the guys who had to hack it to pieces to make it even usable for "clustering" -- "dogfood" indeed). /:

        - tye (but my friends call me "Tye")