On Fri, May 14, 2004 at 07:59:40PM -0500, max wrote: [...] > So i use another bash script to load the environment and run the perl script > from one line in the crontab, the content of the load and run script is this: > > ----------------------------------------------------------------------------------- > !/bin/sh > . ~max/tmp/g_amb.sh # <-- This Loads the environment. > /home/max/tmp/l_amb.pl # <-- This uses the environment loaded. > ----------------------------------------------------------------------------------- > > How could i load the environment from the perl script without using the load > and run script ? > > Some perl or bash scripts are going to use the environment variables and i > dont want to define the variables on every script,
Max, It sounds like you have a perfectly good solution. Quite honestly, I would stick with it. Here's why: First off, you've got two factors working together here: 1) Multiple Perl scripts must be able to see these variables. 2) At the time the Perl scripts are run, the environment is not normally available. #1 says that you need to centralize the variables somewhere so that multiple scripts can load them up. #2 says that you are going to need to take some explicit action to instantiate the variables. If you don't like that, then something like the following might work (not tested): -------------- File MyEnv.pm in @INC package MyEnv; use Env; $ENV{PVAR} = 'p var'; $ENV{XVAR} = 'x var'; -------------- End -------------- Begin script file: #!/usr/bin/perl use MyEnv; -------------- End -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>