in reply to Re: Perl script to EXE to Windows Service
in thread Perl script to EXE to Windows Service

Anyway try to force pp to include the ...\perl\site\lib\auto\Win32\Daemon\Daemon.dll

That was it. It works now. Is this something I should not have had to do under "normal" circumstances? Is there something that I should look for to determine whether or not to explicitly linking in the daemon.dll?

In any case, what a great piece of advice. I am off to drink some eggnog now. I will lift a chalice to you as thanks for your invaluable help.

Update: A thought occurred to me. My script is writing out a log. I have hard-coded the path to the log in my script before converting it to the exe which I then converted to the service. This path is likely going to be different in the target computer(s). How do I externalize this path to the log file so I can still create the exe and install it as a service on a target computer, yet change the log file path (and, perhaps, other config vars as well) at will... you know, stop the service, change a few config params, restart the service, a la Apache.exe does on Windows?

  • Comment on Re^2: Perl script to EXE to Windows Service

Replies are listed 'Best First'.
Re^3: Perl script to EXE to Windows Service
by Jenda (Abbot) on Dec 31, 2004 at 18:06 UTC

    No you should not have to tell PAR to include the DLL, it should do that automaticaly.

    I can only repeat the Win32::Daemon::Simple suggestion. It'll allow you to add the ability to install/uninstall/start/stop the service by the executable itself, set parameters that will be stored in the registry, be changed by the executable and presented to the script as constants.

    Jenda
    We'd like to help you learn to help yourself
    Look around you, all you see are sympathetic eyes
    Stroll around the grounds until you feel at home
       -- P. Simon in Mrs. Robinson

Re^3: Perl script to EXE to Windows Service
by holli (Abbot) on Dec 31, 2004 at 09:54 UTC
    use
    a) the registry
    b) a .ini-file located in the directory where the .exe is. you can get the path to the .exe by calling PerlSvc::exe()
      or even supply it as a parameter to the service, i.e. "Start Parameters" when you show service properties. Supply a "reasonable" default when the service installs, or even ask for the parameter during installation
      the hardest line to type correctly is: stty erase ^H
        well, using the "registry", and ini file, or the "Start Parameters" is going to be an adventure for me as I have no idea how to go about using these to replicate what I was doing in a normal script.

        I started off with all the config params (about 40 of them -- some more stable than the others -- that is, some with more predictable values, while others that might need to be changed relatively frequently by the users of the program).

        Then I migrated the config params to a conf file that I read in with my own home grown method.

        Then I converted to using Config::Simple that brings in the params in a nice hash.

        Now, I am converting my script to an exe and that to a service. Afaiunderstand, everything in a service has to be hard- and long- coded because the service is running as a Local System account and needs to know exactly where to find what. That, and fact that I don't understand when exactly does the service read in the config params -- at the time that it is installed, or at the time that it is started -- creates problems.

        I would like the administrator of the service to be able to stop the service, change a param or two in some place convenient such as an external conf file, and restart the service with the new values. What how?

        Thanks to everyone.