in reply to PerlSVC and Cwd::abs_path

The code you have posted seems to work fine to the extent I can test it. I left out the sub Startup ... and made 3 changes:

#use System::System_Constants; ... our $progname = q{Constants::APPLICATION_SERVICE_NAME_SHORT}; ... #Log("\n ProgName: $progname \n");

I simply tested with:

$ cat pm_perlsvc.pl #!/usr/bin/env perl use strict; use warnings; use PerlSvc;

which produces

$ pm_perlsvc.pl Path: /Users/ken/tmp/pm_perlsvc.pl Program Dir: /Users/ken/tmp/ Logfile: /Users/ken/tmp/SCC_Service.log

I see you've used File::Spec->splitpath() to get the path elements. For portability, I would recommend using File::Spec->catpath() rather than the concatenation operator (.) when joining path elements.

You haven't shown the code where you are attempting to call PerlSvc::Startup() which makes debugging from this end rather difficult.

I notice a lot of variables declared with our. If they need to be declared like this, check that you're not modifying $PerlSvc::path, $PerlSvc::directory, etc. outside of the PerlSvc package; if our $whatever is not a requirement, change it to my $whatever.

If none of that helps, post the code with the call to PerlSvc::Startup() for a better answer.

-- Ken

Replies are listed 'Best First'.
Re^2: PerlSVC and Cwd::abs_path
by Anonymous Monk on Nov 05, 2015 at 15:26 UTC

    It seems the Cwd::absolutePath() function call does not work correctly anymore (Hence the "These functions are exported only on request" in the perl doc). My current throws an error 1/5 times where the variable, even when initially initialized, throws an uninitialized error after the $absolutePath = Cwd::absolutePath(); assignment.

    Solution was to use the Cwd::cwd() function call.

    PS: Scary how the absolutePath function was still used even when not exported by request.