Hi ,

  The other alternative is.
  Define a BEGIN block in your perl program.
  BEGIN {
       $ENV{"VAR1"} = "Variable1"; 
       push @INC,"/newpath/you/interested/"; #PATH
definitions
  }

cu
Shiv

--- [EMAIL PROTECTED] wrote:
> 
> Hi Bruce,
> 
> You can include the variables in a shell script
> along with a call to your
> perl script, something like:
> 
> #!/bin/sh
> #
> # setup env that ./setup_vars would have done:
> VAR1="blar1blar" export VAR1
> VAR2="blar2blar" export VAR2
> VAR3="blar3blar" export VAR3
> 
> # setup PATH
> PATH=$PATH:/usr/local/bin:/somewhere/else export
> PATH
> 
> # call your perl script
> cd /usr/local/bin/mine;
> ./myscript.pl & > diag.txt
> 
> I personally don't think its too clever to source
> your .profile from cron.
> What happens in some months (or years) time when you
> or someone else
> changes it?
> 
> Cheers
> Tony Adolph
> 
> 
> 
>                                                     
>                                                     
>                           
>                       Bruce Shaw                    
>                                                     
>                           
>                       <[EMAIL PROTECTED]        To:  
>     "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>     
>                           
>                       b.ca>                    cc:  
>                                                     
>                           
>                                               
> Subject:  environment variables in perl scripts     
>                                 
>                       24.04.2004 08:16              
>                                                     
>                           
>                                                     
>                                                     
>                           
>                                                     
>                                                     
>                           
> 
> 
> 
> 
> I've got a working dbi script but I can only get it
> going live.
> 
> If I run it as a crontab entry, it won't work
> because there's no
> environment
> variables.
> 
> I've even tried something like:
> 
> 12 23 * * * cd /usr/local/bin/mine; ./setup_vars;
> set > set.txt;
> ./myscript.pl & > diag.txt
> 
> where setup_vars is a script that's supposed to set
> my variables.  I've
> also
> got them set in .profile, but when I examine
> set.txt, none of the
> environment variables are there and diag.txt shows
> that nothing has worked
> because the variables are missing.
> 
> What am I doing wrong?
> 
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system
> (http://www.grisoft.com).
> Version: 6.0.659 / Virus Database: 423 - Release
> Date: 4/15/2004
> 
> 
> This communication is intended for the use of the
> recipient to which it is
> addressed, and may contain confidential, personal
> and or privileged
> information. Please contact us immediately if you
> are not the intended
> recipient of this communication, and do not copy,
> distribute, or take
> action
> relying on it. Any communication received in error,
> or subsequent reply,
> should be deleted or destroyed.
> 
> 
> 
> 
> 



        
                
__________________________________
Do you Yahoo!?
Win a $20,000 Career Makeover at Yahoo! HotJobs  
http://hotjobs.sweepstakes.yahoo.com/careermakeover 

Reply via email to