in reply to Re^3: Help needed with WIN32::Service
in thread Help needed with WIN32::Service

The die message is empty! I really don't understand what's going on...

Also, I can't figure out where the log are on my WinXp pro, running ActivePerl...

Replies are listed 'Best First'.
Re^5: Help needed with WIN32::Service
by NetWallah (Canon) on Jun 29, 2010 at 05:00 UTC
    You can use the "event viewer" to track logged error and status messages. From a command prompt, or the "Run" dialog, type "eventvwr" to bring up the event viwer, and examine recent APPLICATION and SECURITY messages.

    Re: Getting perl to report errors - as others have indicated, the Win32:: code apparently does not place the errors in $!.

    Instead, you need something like:

    use Win32::Service; use Win32; ... if (! Win32::Service::GetStatus($host, $serviceName, \%status)){ die "Cannot get $serviceName status : $!\nWin Error:" . Win32::GetL +astError() . "\n"; }

         Syntactic sugar causes cancer of the semicolon.        --Alan Perlis

      Thanks again!

      Finally, we've got something: ACCESS DENIED!

      I'll have to stop here, as I don't manage access rights. Except if someone know how to pass username and passwordtrought the WIN32 (I didn't find how yet)

Re^5: Help needed with WIN32::Service
by kejohm (Hermit) on Jun 28, 2010 at 23:18 UTC

    When you say 'die message', do you mean the $! variable. If so, you may need to examine the $^E instead, as some Win32:: modules set this instead when there is an error.

    You could also try dumping the hash returned by the GetStatus() function to what it contains, using something like the Data::Dump module.