in reply to Re^3: Perl script as windows service
in thread Perl script as windows service

Thank you for the example. I would propose a little modification.

The code to make the call directory-independent could be improved using modules File::Basename and Cwd:

use Cwd; use File::Basename; my $scriptPath = File::Basename::dirname($0); chdir($scriptPath) if $scriptPath; $scriptPath = Cwd::getcwd(); my $script = File::Basename::basename($0); my %serviceConfig = ( name => 'mytest', display => 'mytest', description => 'this is my test description', machine => '', path => $^X, parameters => qq{"$scriptPath/$script" --run}, start_type => SERVICE_AUTO_START, );
The old code with sprintf did not work because you forgot to put the placeholders :)

Thank you again,

Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Don't fool yourself.