CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
I added to %ENV new variables,using Perl script, but nothing was added

 



digioleg54
User

Oct 23, 2017, 12:42 PM

Post #1 of 5 (1347 views)
I added to %ENV new variables,using Perl script, but nothing was added Can't Post

I wrote the Perl script to add environment variablables

Code
#!/export/applications/dte/CPAN/32-5.8.9-cc/bin/perl -w 
use strict;
use lib '/export/applications/dte/perl';
use lib '/export/applications/dte/perl-lib';

#Set the Perl environment into %ENV

$ENV{'XFER_DATA_DIRECTORY'} = '/export/data/xfer';
$ENV{'ORACLE_USER'} = '"dteweb/fiss12web@nyfissad"';
$ENV{'MONITOR_USER'} = 'dtemonitor/monitor567web@nyfisswu';
$ENV{'SQLPLUS'} = '"$ORACLE_HOME/bin/sqlplus -s "';
$ENV{'DTE_WORK_PLACE'} = '$DTE_WORKING_DIR';
$ENV{'SCRIPT_HOME'} = '$DTE_WORK_PLACE/sh';
$ENV{'SQL_HOME'} = '$DTE_WORK_PLACE/sql';
$ENV{'PERL_HOME'} = '$DTE_WORK_PLACE/perl';
$ENV{'CTL_HOME'} = '$DTE_WORK_PLACE/ctls';
$ENV{'PRG_HOME'} = '$DTE_WORK_PLACE/bin';
$ENV{'EXE_HOME'} = '$DTE_WORK_PLACE/bin';
$ENV{'REPORT_HOME'} = '$DTE_WORK_PLACE/rpts';
$ENV{'PERLEXE'} = '/export/applications/dte/CPAN/32-5.8.9-cc/bin/perl';
$ENV{'PERLEXE5X'} = '"${PERLEXE}"';
$ENV{'PERLEXE5XI'} = '"${PERLEXE}"';
exit;


It doesn't show any error when I run it, but didn't add anything to %ENV
Does anybody know, why?
Any help will be appreciated

Thanks


BillKSmith
Veteran

Oct 23, 2017, 1:24 PM

Post #2 of 5 (1342 views)
Re: [digioleg54] I added to %ENV new variables,using Perl script, but nothing was added [In reply to] Can't Post

It is impossible for any program to return any information in the environment. Any changes that you make will be passed to a child process, but not returned. This restriction has nothing to do with perl. It is the way that your OS makes sure that no other program can make unexpected changes to your environment.
Good Luck,
Bill


digioleg54
User

Oct 23, 2017, 1:29 PM

Post #3 of 5 (1341 views)
Re: [BillKSmith] I added to %ENV new variables,using Perl script, but nothing was added [In reply to] Can't Post

Do you mean that I have no rights to add %ENV any variable?
But I need them

Thanks


FishMonger
Veteran / Moderator

Oct 23, 2017, 2:43 PM

Post #4 of 5 (1332 views)
Re: [digioleg54] I added to %ENV new variables,using Perl script, but nothing was added [In reply to] Can't Post

You can change the environment of the current script and its child processes, but you can't change the environment of the parent process which is what you're attempting to do.

This is not a perl limitation. The same holds true for any language. The limitation is at the OS level.


digioleg54
User

Oct 23, 2017, 2:44 PM

Post #5 of 5 (1331 views)
Re: [FishMonger] I added to %ENV new variables,using Perl script, but nothing was added [In reply to] Can't Post

thanks

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives