in reply to Issues with Win32::Daemon

I'm no services expert, so I apologize ahead of time if I missed any service idiosyncrasies, but I hacked a service script together that works at a basic level. Below is the code I have that will properly start and stop w/ no errors. It doesn't include all the pausing, restarting, etc functionality, but it should provide a foundation to build on. All the code is taken from the examples section of the Roth's Consulting site ( http://www.roth.net/perl/Daemon/ ) I stripped it down alot and changed what I felt were typos. If nothing else, this should help to get you started.
use Win32::Daemon; $SERVICE_SLEEP_TIME = 20; Win32::Daemon::StartService(); sleep (1) while(SERVICE_START_PENDING != Win32::Daemon::State()); Win32::Daemon::State(SERVICE_RUNNING); $dontStop = 1; $count=0; # Note: the $count stuff is here in case i can't stop it.. purely for +debugging while (($dontStop) && ($count++ < 600)) { # Process stuff here open(OUT,">>e:\\temp3\\testout.txt"); print OUT localtime(); print OUT " $_\n" for (1..10); close(OUT); if(SERVICE_CONTROL_NONE != ($Message = Win32::Daemon::QueryLastMes +sage())) { if(SERVICE_CONTROL_INTERROGATE == $Message) { Win32::Daemon::State($PrevState); } elsif(SERVICE_CONTROL_STOP == $Message) { Win32::Daemon::State(SERVICE_STOP_PENDING, 25000); $dontStop = 0; } } Win32::Sleep($SERVICE_SLEEP_TIME); } Win32::Daemon::StopService();