Can any of my cellmates answer this small poser - that's the question not me! I have a need to write some Perl code to access some Oracle Database(s). The plural here is the problem. Our UNIX administrator has set the .profile up to include aliases to the other DB's environmental variable - TEST, LIVE & TEACHING. At the UNIX prompt we just type in the alias for the DB to be accessed TEST, LIVE etc and the required PATH's, ORACLE_HOME and any other associated environment details are set up for the DB specified. Is there any way - short of writing a new Perl script to perform the same function - to call TEST/TEACH/LIVE from within a Perl script. I thought I could make a system call to this but had no success. This is probably because TEST/LIVE etc is an alias/function in UNIX and not accessable via Perl or am I talking out of my .........
The following is the code I've been using to try this out -
#!/usr/bin/perl -w
#
print "\n\t<***** SOR *****>\n" ;
#
if (exists $ENV{HOME}) {
print "\n\tOH :: $ENV{ORACLE_HOME}\n" ;
print "\n\tHome :: $ENV{HOME}\n" ;
$file = "$ENV{HOME}/.profile" ;
print "\n\tFile :: $file\n" ;
$result = system "$file" ;
print "\n\tResult :: $result\n" ;
$result = system "ISWTEST" ;
print "\n\tResult :: $result\n" ;
"ISWLIVE" or warn "\n\tNay chunce min!!!\n" ;
print "\n\tOH :: $ENV{ORACLE_HOME}\n" ;
}
else
{
print "\n\tOh no it's nae!\n" ;
}
#
print "\n\t<***** EOR *****>\n" ;
This results in the semi-expected -
<***** SOR *****>
OH :: /isw/tpp/oracle/test/8.1.7
Home :: /home/interface
File :: /home/interface/.profile
Result :: 0
Can't exec "ISWTEST": No such file or directory at xxrc_profile.pl lin
+e 12.
Result :: -1
OH :: /isw/tpp/oracle/test/8.1.7
<***** EOR *****>
Cheers,
Ronnie
edit (broquaint): added <code> tags