[EMAIL PROTECTED] (William R Ward) writes:
> [EMAIL PROTECTED] (William R Ward) writes:
> > Where I work we have a variety of versions of Oracle installed in
> > various possible values of $ORACLE_HOME.  It is necessary to have the
> > environment variable $ORACLE_HOME match the version under which
> > DBD::Oracle was compiled, in order for it to work.  For example, if
> > $ORACLE_HOME points to an 8.0.6 directory but DBD::Oracle was linked
> > with 8.1.6, we get a rude segmentation fault.
> 
> Let me clarify.  We also have different versions of Perl, and each
> one's DBI is linked against a different version of the Oracle client
> libs.  So it's hard to know for sure if you've got the right
> $ORACLE_HOME.

I figured out one way to do it:

my $found;
foreach my $dir (@INC) {
    my $file = "$dir/auto/DBD/Oracle/Oracle.so";
    next unless -r $file;
    $found = `strings $file` =~ /$ENV{ORACLE_HOME}/;
    last;
}
die "ORACLE_HOME ($ENV{ORACLE_HOME}) does not match DBD::Oracle\n"
    unless $found;

However, my boss favors modifying DBD/Oracle.pm to include a die
statement if the desired ORACLE_HOME is not found.

Tim, any chance we could have some support for this type of error
checking shipped with future versions of DBD::Oracle?  Running strings
on a binary is tacky, but if the MakeMaker values could be cached, it
would be easy to do.  It would of course be optional...

--Bill.

-- 
William R Ward            [EMAIL PROTECTED]          http://www.wards.net/~bill/
-----------------------------------------------------------------------------
     If you're not part of the solution, you're part of the precipitate.

Reply via email to