in reply to Re^3: how to make pp-created exe read external config values
in thread how to make pp-created exe read external config values

That is a function that returns the pah to the .exe file
well, I already know the path to the exe file because I put the exe file there. My problem is that I want to now change something inside the exe file before making it into a Windows service. Except, the target computer on which the exe file resides does not have Perl (after all, that is why I made an exe file in the first place).

In short, I need to know how I could change something inside the exe file created by pp before I convert it into a service.

  • Comment on Re^4: how to make pp-created exe read external config values

Replies are listed 'Best First'.
Re^5: how to make pp-created exe read external config values
by holli (Abbot) on Jan 05, 2005 at 14:19 UTC
    well, I already know the path to the exe file because I put the exe file there

    i am confused, i think your problem is the path to the config-file is hardcoded. so if you replace that hardcoded path with
    use File::Basename; ($exename, $exepath) = fileparse(PerlSvc::Exe()); Config::Simple->import_from("${exepath}foo.conf");
    there´s no need to change the exe-file. just keep the .conf besided the .exe
      that is a good idea. Thanks. I will see if that will work for me.

      The problem, thus far, has been that a perl program converted to Windows service needs to have everything hard-coded. That is because the Windows service manager is dumb and can't figure out relative path names. You solution might work -- make the exe figure out its path. In fact, I think there is a perl special var that holds the path and name of the script being run.

      Many thanks.

        if that doesn´t work use $ENV{'SystemRoot'} (mostly c:\windows) and put your .conf there.