environment variables in perl

2011-07-18 Thread Irfan Sayed
hi,

i am executing one shell script within perl script. now what i need is , i need 
to make available all the variables set by that shell script to perl script
for example 

following is the shell script
build="abc"
export build
echo $build

now the value of $build i need to access in perl script 


if i do in perl like this :
print "Environment is : $ENV{'build'}\n";

then it does not pint anything 

can someone please suggest ??

regards
irf


environment variables in perl

2011-07-18 Thread Irfan Sayed
hi,
i am executing one shell script within perl script. now what i
 need is , i need to make available all the variables set by that shell 
script to perl script
for example 

following is the shell script
build="abc"
export build
echo $build

now the value of $build i need to access in perl script 

if i do in perl like this :
print "Environment is : $ENV{'build'}\n";
then it does not pint anything 
can someone please suggest ??

regards
irf

Re: environment variables in perl

2011-07-18 Thread Shawn H Corey

On 11-07-18 07:29 AM, Irfan Sayed wrote:

if i do in perl like this :
print "Environment is : $ENV{'build'}\n";

then it does not pint anything

can someone please suggest ??


In Windows, there is only one environment.  That means if a child 
process changes it, its parent can access the change.


In Linux, each process has its own environment.  The child process 
inherits its parent's at the time of the fork and each is independent 
thereafter.


If you want two processes to communicate, you need techniques called 
Inter-Process Communication (IPC).  See `perldoc perlipc` for details.



--
Just my 0.0002 million dollars worth,
  Shawn

Confusion is the first step of understanding.

Programming is as much about organization and communication
as it is about coding.

The secret to great software:  Fail early & often.

Eliminate software piracy:  use only FLOSS.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: environment variables in perl

2011-07-18 Thread Christian Walde

On Mon, 18 Jul 2011 13:44:39 +0200, Shawn H Corey  wrote:


In Windows, there is only one environment.  That means if a child
process changes it, its parent can access the change.

In Linux, each process has its own environment.  The child process
inherits its parent's at the time of the fork and each is independent
thereafter.


That is most certainly not the case. On Windows %ENV behaves like it does on 
Linux:

https://gist.github.com/899a1385b703bba7f552

--
With regards,
Christian Walde

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




Re: environment variables in perl

2011-07-18 Thread Shawn H Corey

On 11-07-18 09:24 AM, Christian Walde wrote:

On Mon, 18 Jul 2011 13:44:39 +0200, Shawn H Corey
 wrote:


In Windows, there is only one environment. That means if a child
process changes it, its parent can access the change.

In Linux, each process has its own environment. The child process
inherits its parent's at the time of the fork and each is independent
thereafter.


That is most certainly not the case. On Windows %ENV behaves like it
does on Linux:

https://gist.github.com/899a1385b703bba7f552



OK, that makes things easier.  Use `perldoc perlipc` for both.


--
Just my 0.0002 million dollars worth,
  Shawn

Confusion is the first step of understanding.

Programming is as much about organization and communication
as it is about coding.

The secret to great software:  Fail early & often.

Eliminate software piracy:  use only FLOSS.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/




setting the environment variables in perl

2004-07-27 Thread jason corbett
How does one go about assuring that the environment variables are properly set in 
perl? I read several books, but none go in depth about how to write a script that 
includes all the required variables, that way nothing gets left out. 
 
Please advise.
 
JC
 
[snipet]
 
 
#!/usr/bin/perl -w

$ENV{"ORACLE_HOME"}="/orav101/oracle/8.1.7";

use strict; 
use DBI;
use lib '/home/samcsm/jason/myperl/lib/perl5/site_perl/';

 



Please Stop (Was: environment variables in perl)

2011-07-18 Thread Shawn H Corey
Could someone please remove lel...@claimspages.com from the mailing list 
so I won't get any more of these annoying messages?




 Original Message 
Subject: Re: Re: environment variables in perl
Date: Mon, 18 Jul 2011 09:31:05 -0400
From: RightFax E-mail Gateway
To: shawnhco...@gmail.com

Valid fax destination information could not be found
in your mail message.  The message was discarded.

Examples of properly formatted messages:

  /name=frank/fax=3217...@faxgate.company.com
  Frank Smith /name=frank/fax=3217453/ 

The original message information follows:

Received: from mx.npci.net ([10.0.1.60]) by mail.claimspages.com with
Microsoft SMTPSVC(5.0.2195.7381);
 Mon, 18 Jul 2011 09:30:33 -0400
Received: from localhost (unknown [127.0.0.1])
by mx.npci.net (Postfix) with ESMTP id 1DA252E46D7
for ; Mon, 18 Jul 2011 13:30:33 + (UTC)
X-Virus-Scanned: amavisd-new at nationwide.net, cpdev20.com, claimspages.com
Received: from mx.npci.net ([127.0.0.1])
by localhost (del-mx1.nationwide.net [127.0.0.1]) (amavisd-new, port
10024)
with ESMTP id MI6gJtK7KlS8 for ;
Mon, 18 Jul 2011 09:30:28 -0400 (EDT)
Received: from x6.develooper.com (x6.develooper.com [207.171.7.86])
by mx.npci.net (Postfix) with ESMTP id 39AAA2E4605
for ; Mon, 18 Jul 2011 09:30:28 -0400 (EDT)
Received: from lists-nntp.develooper.com (localhost.localdomain [127.0.0.1])
by x6.develooper.com (Postfix) with SMTP id 36BB117AFD
for ; Mon, 18 Jul 2011 06:30:27 -0700 (PDT)
Received: (qmail 9521 invoked by uid 514); 18 Jul 2011 13:29:50 -
Mailing-List: contact beginners-h...@perl.org; run by ezmlm
Precedence: bulk
List-Post: <mailto:beginners@perl.org>
List-Help: <mailto:beginners-h...@perl.org>
List-Unsubscribe: <mailto:beginners-unsubscr...@perl.org>
List-Subscribe: <mailto:beginners-subscr...@perl.org>
List-Id: 
Delivered-To: mailing list beginners@perl.org
Received: (qmail 9512 invoked from network); 18 Jul 2011 13:29:50 -
Received: from x1.develooper.com (207.171.7.70)
  by x6.develooper.com with SMTP; 18 Jul 2011 13:29:50 -
Received: (qmail 26240 invoked by uid 225); 18 Jul 2011 13:29:50 -
Delivered-To: beginners@perl.org
Received: (qmail 26236 invoked by alias); 18 Jul 2011 13:29:49 -
X-Spam-Check-By: la.mx.develooper.com
Received: from mail-vw0-f41.google.com (HELO mail-vw0-f41.google.com)
(209.85.212.41)
by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Mon, 18 Jul 2011
06:29:44 -0700
Received: by vws4 with SMTP id 4so3098673vws.14
for ; Mon, 18 Jul 2011 06:29:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=gamma;

h=message-id:date:from:user-agent:mime-version:to:subject:references
 :in-reply-to:content-type:content-transfer-encoding;
bh=0oU4EoHhRGGQ+TFWKrCgE8L4pIxsgHBURGWQoZr08zo=;

b=vyA9wm2NsoAHFInyWqaAcgbA/r4ZD0qNVc+GISayCEfhqPXBJp/IYx3tPpPXUlbpzx

yqJvuwmYlTsvW79qzA/sJiX2RPz/hVElxvy8Ne7lxlIre/W3XiTcIrXOgTBpabZtpDlb
 7R+qlmo6qSEIK414Q5LVeoIm4WTVqceWJTxJo=
Received: by 10.52.174.113 with SMTP id br17mr2061178vdc.107.1310995780751;
Mon, 18 Jul 2011 06:29:40 -0700 (PDT)
Received: from [192.168.2.11] (bas3-ottawa10-1279403673.dsl.bell.ca 
[76.66.38.1

53])
by mx.google.com with ESMTPS id 
pm1sm1853114vcb.33.2011.07.18.06.29.39

(version=SSLv3 cipher=OTHER);
Mon, 18 Jul 2011 06:29:39 -0700 (PDT)
Message-ID: <4e243542.9060...@gmail.com>
Date: Mon, 18 Jul 2011 09:29:38 -0400
From: Shawn H Corey 
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.18) 
Gecko/201106

17 Thunderbird/3.1.11
MIME-Version: 1.0
To: beginners@perl.org
Subject: Re: environment variables in perl
References: <1310988574.50369.yahoomail...@web125509.mail.ne1.yahoo.com>
<4e241ca7.2080...@gmail.com> 
In-Reply-To: 
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Return-Path: beginners-return-117932-lellis=claimspages@perl.org
X-OriginalArrivalTime: 18 Jul 2011 13:30:33.0204 (UTC) 
FILETIME=[DEA54340:01CC4

54E]

On 11-07-18 09:24 AM, Christian Walde wrote:

On Mon, 18 Jul 2011 13:44:39 +0200, Shawn H Corey
 wrote:


In Windows, there is only one environment. That means if a child
process changes it, its parent can access the change.

In Linux, each process has its own environment. The child process
inherits its parent's at the time of the fork and each is independent
thereafter.


That is most certainly not the case. On Windows %ENV behaves like it
does on Linux:

https://gist.github.com/899a1385b703bba7f552



OK, that makes things easier.  Use `perldoc perlipc` for both.


--
Just my 0.0002 million dollars worth,
   Shawn

Confusion is the first step of understanding.

Programming is as much about organization and communication
as it is about coding.

The secret to great software:  Fail early & often.

Eliminate software piracy:  use on

Re: setting the environment variables in perl

2004-07-27 Thread Paul Kraus
You can access all the env variables like this...

$ENV{ 'VAR' }

example
my $home = $ENV{ 'HOME' };
print "$home\n";

I have never tried to change them but I would assume
that it would work.

HTH,
Paul Kraus

On Tue, Jul 27, 2004 at 07:29:45AM -0700, jason corbett wrote:
> How does one go about assuring that the environment variables are properly set in 
> perl? I read several books, but none go in depth about how to write a script that 
> includes all the required variables, that way nothing gets left out. 
>  
> Please advise.
>  
> JC
>  
> [snipet]
>  
>  
> #!/usr/bin/perl -w
> 
> $ENV{"ORACLE_HOME"}="/orav101/oracle/8.1.7";
> 
> use strict; 
> use DBI;
> use lib '/home/samcsm/jason/myperl/lib/perl5/site_perl/';
> 
>  
> 


pgp1DvCvYBmPM.pgp
Description: PGP signature


Re: setting the environment variables in perl

2004-07-27 Thread Flemming Greve Skovengaard
Paul Kraus wrote:
You can access all the env variables like this...
$ENV{ 'VAR' }
example
my $home = $ENV{ 'HOME' };
print "$home\n";
I have never tried to change them but I would assume
that it would work.
HTH,
Paul Kraus
On Tue, Jul 27, 2004 at 07:29:45AM -0700, jason corbett wrote:
How does one go about assuring that the environment variables are properly set in perl? I read several books, but none go in depth about how to write a script that includes all the required variables, that way nothing gets left out. 

Please advise.
JC
[snipet]
#!/usr/bin/perl -w
$ENV{"ORACLE_HOME"}="/orav101/oracle/8.1.7";
use strict; 
use DBI;
use lib '/home/samcsm/jason/myperl/lib/perl5/site_perl/';



Use this one-liner to check your environment variables:
perl -Mstrict -we 'foreach my $key (sort keys %ENV) { print "$key => 
$ENV{$key}\n" }'

--
Flemming Greve SkovengaardThe prophecy of the holy Norns
a.k.a Greven, TuxPowerthe world is doomed to die
<[EMAIL PROTECTED]>   fire in the sky
4112.38 BogoMIPS  the end is coming soon
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



RE: setting the environment variables in perl

2004-07-27 Thread Bob Showalter
jason corbett wrote:
> How does one go about assuring that the environment variables are
> properly set in perl? I read several books, but none go in depth
> about how to write a script that includes all the required variables,
> that way nothing gets left out.

It's really not a Perl issue per se. I assume you're talking about variables
used by Oracle libraries, like ORACLE_HOME and ORACLE_SID.

I advise you to *not* attempt to set or monkey with these variables inside
the Perl script. The whole point of environment variables is so the user can
establish his environment *before* invoking your script.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: setting the environment variables in perl

2004-07-27 Thread u235sentinel
Good point in fact Oracle (for example) recommends setting the environment before you 
even install Oracle.  To do it any other way invites trouble and as Oracle would say, 
you're on your own :-)


> jason corbett wrote:
> > How does one go about assuring that the environment variables are
> > properly set in perl? I read several books, but none go in depth
> > about how to write a script that includes all the required variables,
> > that way nothing gets left out.
> 
> It's really not a Perl issue per se. I assume you're talking about variables
> used by Oracle libraries, like ORACLE_HOME and ORACLE_SID.
> 
> I advise you to *not* attempt to set or monkey with these variables inside
> the Perl script. The whole point of environment variables is so the user can
> establish his environment *before* invoking your script.
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>  
> 
> 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: setting the environment variables in perl

2004-07-27 Thread perl.org
On Tue, 27 Jul 2004 11:58:51 -0400, Bob Showalter wrote
> 
> It's really not a Perl issue per se. I assume you're talking about variables
> used by Oracle libraries, like ORACLE_HOME and ORACLE_SID.
> 
> I advise you to *not* attempt to set or monkey with these variables inside
> the Perl script. The whole point of environment variables is so the 
> user can establish his environment *before* invoking your script.

I agree with this in general, but sometimes the environment in which your Perl
runs cannot define these variables for you.  For instance, Interwoven TeamSite
Data Capture Template inline callout invocations clear all environment
variables before forking your process (the vendor claims this is for security
reasons).  For Oracle you must set ORACLE_HOME, etc, and for SQL Server you
have to define SYSTEMROOT or something like that or ODBC or whatever doesn't
work.  If coded, this logic of course belongs in a module.  

I also sometimes use environment variables to hold global configurables when
it is not feasible to pass these values to the subroutines that need them. 
It's faster for the subroutine to use an environment variable than to do a
lookup into a flat file to get some configuration info.  If I put this in the
environment before forking the process the space would be cluttered.  If
there's a better way to cache global confgiurables or other feedback on these
subjects I am all ears - I don't like using the environment, let alone setting
values that should be set elsewhere.

Thanks,

   -John


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]