in reply to Re^5: Turn a perl script into a Win32 Service
in thread Turn a perl script into a Win32 Service
The following works for me on XP:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SrvAny\Parameter +s] "Application"="\\perl\\bin\\wperl.exe \\test\\service.pl"
Modify the paths to your wperl and script accordingly.
#! perl -slw use strict; use Win32; open LOG, '>', 'c:\test\service.log' or die; select LOG; $|++; Win32::MsgBox( 'From service.pl at ' . localtime, 0, "Service.pl" ); while( sleep 5 ) { Win32::MsgBox( 'From service.pl at ' . localtime, 0, "Service.pl" + ); print scalar localtime; } close LOG;
It pops up a message box on startup and every 5 seconds thereafter. (And bloody annoying it is too :)
It creates and writes to the log file.
YMMV on Vista.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Turn a perl script into a Win32 Service
by Limbic~Region (Chancellor) on Oct 14, 2008 at 17:54 UTC | |
|
Re^7: Turn a perl script into a Win32 Service
by Limbic~Region (Chancellor) on Oct 16, 2008 at 00:25 UTC | |
by BrowserUk (Patriarch) on Oct 16, 2008 at 01:15 UTC | |
by Limbic~Region (Chancellor) on Oct 16, 2008 at 01:52 UTC |