Ahh. I've run into similar problems before. Win32 services are more difficult to debug because you can't see what's going on. What I've done in the past is log errors to a text file. This is fine for development, but in production you probably want to use the Event Log, with
Win32::EventLog or Win32::EventLog::Message - I don't have a link, but I think it's another one of
Dave Roth's.
I find something along these lines useful:
BEGIN
{
$SIG{__WARN__} = $SIG{__DIE__} =
sub {
open ERRORLOG, ">>/myerror.log" or
die "error opening logfile";
print ERRORLOG, scalar localtime, " - $0\n", @_, "\n\n";
close ERRORLOG;
}
}
I think this would have caught your problem and written it to a log file.
John M. Dlugosz pointed out recently that you can also use Win32::MessageBox from within a Service. So you could replace that logfile with a more immediate and visual prompt.
Simon Flack ($code or die)
$,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
=~y'_"' ';eval"die";print $_,lc substr$@,0,3;