In the examples the functionality to "Create a Service" is in a different script but you could have that in the same script. You could put the install routine in a sub that only runs when a certian parameter is added eg --install. I have seen binary services written in C that implement things this way. IMHO the install routine simply adds the appropriate registry settings so the Service Control Manager can find the perl interpreter and give it the first parameter which is the full path of the perl script. The Service Control Manager is then responsible for starting, restarting and stopping your service.
AFAIK the "Not in timely fashion" error that you may see when getting the Service Control Manager to start the service is because the script did not notify the Service Control Manager of successful start up before a timeout.
--blm--