ActiveState Community

Problem with variables in compile perlsvc script

Posted by jmozley on 2008-07-24 06:22

I am using the dev kit for the first time to create a windows service.

The issues I am having are with trying to get the service to run.

I have created a script along the lines of the PingSvc.pl example as I want something that can be run interactively and as a service.

I can get it compiled OK and run it interactively (using Komodo) without errors.

The problem I have is after compiling when trying to start the service.

At first I had variables with values assigned that did not seem to have values. For instance when I put a message to the event log expecting to see the value in "Logfile path $servicelogfile" I would see "Logfile path " even though $servicelogfile was set. So I started to use a BEGIN block. This enabled me to get further but I now see in the event log:

Undefined subroutine &PerlSvc::Startup called at /PerlSvc.pm line 95

I do not have this subroutine anywhere near line 95.

I think I need some help in the correct way to make variables and subroutines known at the right time. Apologies if this is bordering on general Perl questions.