in reply to Turn a perl script into a Win32 Service

I've been trying out some of the options above, but I've encountered some issues.

Win32::Daemon is working for me, but I'd like to use Win32::Daemon::Simple because otherwise there's a lot of skeleton code to write and, well, it's just simpler :-)

Unfortuantely, it's throwing up some errors as soon as I try to use it:

C:\tmp>perl use Win32::Daemon; use Win32::Daemon::Simple; Global symbol "$HKLM" requires explicit package name at C:/APPS/Perl/s +ite/lib/Win32/Daemon/Simple.pm line 66. Global symbol "$HKLM" requires explicit package name at C:/APPS/Perl/s +ite/lib/Win32/Daemon/Simple.pm line 78. Global symbol "$HKLM" requires explicit package name at C:/APPS/Perl/s +ite/lib/Win32/Daemon/Simple.pm line 276. BEGIN not safe after errors--compilation aborted at C:/APPS/Perl/site/ +lib/Win32/Daemon/Simple.pm line 494. Compilation failed in require at - line 2. BEGIN failed--compilation aborted at - line 2.
The Win32::Daemon::Simple code is using a variable $HKLM (when attempting to talk to the Windows registry) but it's not defined in Simple.pm.

Any ideas why this is fouling up? Where is this variable supposed to come from?

One obvious area for consideration is module incompatibilites, so here are the versions I'm using:

Win32::Daemon $VERSION = 20030617; Win32::Daemon::Simple $VERSION = '0.2.6'; Win32::Registry $VERSION = '0.07';
<fingers crossed...>

--
.sig : File not found.

Replies are listed 'Best First'.
Re^2: Turn a perl script into a Win32 Service
by Limbic~Region (Chancellor) on Oct 14, 2008 at 15:21 UTC
    wol,
    First, where did you get Win32::Daemon from? The one on CPAN is very old - you should get the one directly from Roth's site (links elsewhere in the thread) though I don't know if Win32::Daemon::Simple will still work with it.

    Second, what's your configuration? I am specifically interested in AS 5.10 on Vista but have XP with SP3 to test with as well. If you are not familiar with Roth's forums for his modules, you should cross post this there (which is what I did for my question - link in the root node).

    Third, thank you so much for actually trying to get this to work rather than just point to resources that aren't working. I don't mean that as a slight to others who have contributed but I have explained on a number of occassions that SrvAny just isn't working and that converting an existing application over to Win32::Daemon isn't as simple as use Win32::Daemon; (looking for a "how to" guide).

    Cheers - L~R

      OK - lots of little questions to answer...

      Yes, the Win32::Daemon module came direct from Roth Consulting's Official Win32::Daemon Home Page, using the dead simple instructions there:

      If you have ActivePerl (aka Perl from ActiveState Tool Corp. version 5.005 or higher) or if you have Core Perl 5.005 compiled with the PERL_OBJECT macro defined you can auto download and install the extension. You need to run the Perl Package Manager script which comes with Perl in the perl\bin directory:
      perl ppm.pl install http://www.roth.net/perl/packages/win32-daemon.ppd
      This will automatically download and install the latest version.
      I'm running wih Perl v5.8.7 (build 813 from ActiveState) on Win XP.

      I've not cross-posted to the Win32::Daemon forms there, but I'll try tomorrow (time to go $home now).

      I don't know if Win32::Daemon::Simple will still work with it.
      That would appear to be the million dollar question (but remember that the value of your question can go down as well as up).

      Until tomorrow...

      --
      .sig : File not found.