in reply to Perl exe as a service, stuck on starting

hello Garden Dwarf,

I'd really like to help you (I abandoned my tries with windows services since service did not start in timely fashion errors..) but I'm unable to reproduce your ~working example.

I'm trying on Win10 with strawberry 5.26 64bit with all modules up to date: Win32::Daemon::Simple 0.2.6 Win32::Daemon 20131206 Win32::Registry 0.12 PAR::Packer 1.041

If I try your example (with a simple print to file and sleep function as work) or even if I try the TestSimpleService.pl that comes within the distribution I get no luck make them working..

First annoyances are in packing it: if I

pp daemon-simple01.pl -o daemon-simple01.exe

when I run as administrator I get

Can't locate utf8_heavy.pl in @INC (@INC contains:...

I found somewhere pp -u so I issued the packing with -u but I get:

Global symbol "$HKLM" requires explicit package name (did you forget t +o declare "my $HKLM"?) at Win32/Daemon/Simple.pm line 66.

This come from the no more used Win32::Registry module...

So how did you packed the program? Which strawberry version are you using? 32bit?

The only help I can offer you at the moment is about different way you can start and query a service: you have the gui interface services that is different from that of the task manager and you also have, as commandline tools, the net service command and the sc one. just to be sure all of them return the same results you are seeing now from the task manager.

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^2: Perl exe as a service, stuck on starting
by Garden Dwarf (Beadle) on Feb 27, 2018 at 11:15 UTC

    I first replaced the Registry.pm (./perl/site/lib/Win32/ on my installation) from the installed module Win32::Registry by the one found here: http://jenda.krynicky.cz/#Win32::Registry2. This Registry.pm package contains the HKLM definition (amongst with other changes). I had also to change the version as it was expecting the one from the original Win32::Registry (you'll see that error and the expected version if you do not change anything). There should be a more "clean" way to replace this package, but at least what I did is working. This should solve your issue.

    Then I'm using an older version of pp (1.014). This is because I wanted to change the exe icon, and with newer versions you can't.

    Maybe not important for you, but with the installation of libraries I also have an issue with the "ar" command, which generates issues at compilation time (g++ issue message about ".a" files that are not recognized). I compiled the ".a" files with "ar" on another platform (Cygwin).

    I'm using Strawberry Portable (v5.14.4) on Win10.

    I hope that this will help you running your program. If not, just ask ;)

        Thanks for the information, good to know but I won't use that method unless I really have to. I need to compile multiple applications with different icons, and that method is a bit tricky in my case.