Perl, Oracle, and a browser

From: Yurasis Dragon <spam_at_smeagol.com>
Date: Sat, 01 Dec 2001 04:29:02 GMT
Message-ID: <nfmg0ucbve6sccavr30t76kod4nem23d13_at_4ax.com>



I'm playing with Perl and DBI and Oracle DBD and have been able to get my Perl script read an Oracle database and output the results at the command line.

However, once I put the script in the cgi-bin and try to run it from a browser, I get not output ( can't remember the exact message, sorry ).

I dug around a little more and found that I need to add something like :

        print "Content-type: text/plain\n\n" ;

So I added that code ... but still no output to a browser.

I wrote a small Perl script, a "hello world" type, and added the above line and the script output to a browser, no problem.

It seems to be when I try to connect to an Oracle database that I have the problem. So I ran the script at the command line as root and found that it did not run correctly until I defined ORACLE_HOME. So this leads me to suspect that Apache needs to know about ORACLE_HOME in order for my Perl script that accesses an Oracle database to work in a browser.

So the question is where do I define ORACLE_HOME and how. Is it something like "SetEnv ORACLE_HOME /oracle/product/8.1.7" added in httpd.conf?

I think that I can do a similar thing in my Perl script directly ( I'm pretty new to Perl but do recall that I can set an environment variable in Perl ) but I don't want to have to do that to every Perl script, a more global solution is preferable and much more elegant.

Any suggestions? Thanks in advance.

===
Yurasis Dragon
spam_at_smeagol.com Received on Sat Dec 01 2001 - 05:29:02 CET

Original text of this message