Probably not the answer in this case but a useful point to note:
I created a free standing PerlSvc that worked once while I was logged in and always
failed once I had logged out. The problem was fixed once the "allow service
to interact with desktop" option in the services control panel - log on tab
was unchecked.
Cheers
Richard