Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

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.


Comment on Re: Running Perl code from a Windows service
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://113399]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (10)
As of 2014-09-16 17:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (36 votes), past polls