in reply to Re^3: Perl script as windows service
in thread Perl script as windows service
The code to make the call directory-independent could be improved using modules File::Basename and Cwd:
The old code with sprintf did not work because you forgot to put the placeholders :)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, );
Thank you again,
Flavio
perl -ple'$_=reverse' <<<ti.xittelop@oivalf
|
|---|