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: Re: [digioleg54] How can I read UNIX nvironment varaibles in Perl script?: Edit Log



FishMonger
Veteran / Moderator

Oct 26, 2017, 7:32 AM


Views: 11940
Re: [digioleg54] How can I read UNIX nvironment varaibles in Perl script?

You don't need the dispatch script.

perlenv_add.pl

Code
#!/usr/bin/perl 

use warnings;
use strict;

$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}"';
$ENV{'PERLEXE5XD'} = '"${PERLEXE}"';


myApp.pl

Code
#!/usr/bin/perl 

use warnings;
use strict;
do 'perlenv_add.pl';

print "\nThis is you application speaking\n";
print "ORACLE_USER = $ENV{ORACLE_USER}\n";


Outputs:

Quote

This is you application speaking
ORACLE_USER = "dteweb/fiss12web@nyfissad"


Be aware that your use of the shell vars in those assignments won't work like that.


(This post was edited by FishMonger on Oct 26, 2017, 7:37 AM)


Edit Log:
Post edited by FishMonger (Veteran) on Oct 26, 2017, 7:37 AM


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

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