Recently there was a change at work -- all http access now needs to go through a proxy.

So if I have a script using LWP::UserAgent or similar, I have to add

    $UA->proxy( ['http'] , 'http://proxy.fake.com:8080' );

to all my scripts. Which is a big pain. So a *NIX guy said "you shouldn't need to do that if you can add an environment variable to your shell".

So, as I use tcsh, not bash, which is the default nowadays, I added this to .tcshrc:

    setenv http_proxy http://proxy.fake.com:8080

and it seemed to work, but leaving aside the specifics of the scripts, how would Perl "know" that I use tcsh, not bash? Isn't that a preference of the Terminal app, not of me as a user? A script run as a cron job, does it run using all the environment variables as if I'd typed its name into the Terminal? What about a script run from BBEdit? What if I "su root" and run it?

I'd really appreciate someone explaining the relationship of script to shell and user.


Reply via email to