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


In reply to Unix Aliases? by Ronnie

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.