Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Running Perl code from a Windows service

by jbert (Priest)
on Sep 19, 2001 at 20:31 UTC ( #113399=note: print w/replies, xml ) Need Help??

in reply to Running Perl code from a Windows service

The usual gotcha I find is that the services do not set the environment variables of the user they run as. Often this is the PATH, but you've covered that.

However, some external executables require their own environment variables to be set to work. You happily check that a given user account has them set, you happily set the service to run as that user, you log in as that user and check it all runs OK. But it doesn't work as a service.

So...check the environment of the user for which your script works and try setting likely things in %ENV before you run the command.

If nothing looks likely, you can eliminate this as the potential issue by simply importing the entire environment. Run a 'set > env.txt' command in a command prompt as the user which this works for, and then do something along the lines of:

open( ENVFILE, "< env.txt" ) or die_screaming_in_agony(); %ENV = map( split /=/, $_, 2 } <ENVFILE>; # Untested, looks cool thoug +h
Good luck.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://113399]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (8)
As of 2018-04-22 21:09 GMT
Find Nodes?
    Voting Booth?