There's a couple of extra quirks to consider when building on Cygwin. You
have to specify ORACLE_HOME as a Windows-native path (since Oracle itself
needs it, and won't understand Cygwin paths) e.g.:
c:\oracle\ora92
(or with the slashes reversed) ... but PATH must contain only Cygwin-style
paths, e.g.:
/cygdrive/c/oracle/ora92
Since $Config{path_sep} on Cygwin is ":" (as on Unix), the ":" in the drive
specification messes things up when it's added to PATH - it adds two
non-existent directories instead of the Oracle home.
The path ought to be run through `cygpath -u` first. As far as I can see
this is the only place where a path list is being built up; for individual
file operations, Cygwin will accept either sort of path.
The next quirk is Cygwin and/or Perl's handling of "-x" to find if
sqlplus.exe is executable in "find_bin". See:
http://www.cygwin.com/ml/cygwin/2005-06/msg00168.html
http://www.cygwin.com/ml/cygwin/2005-06/msg00313.html
To get Cygwin to report sqlplus.exe as actually executable, it needs the
"use filetest 'access'" pragma adding.
http://search.cpan.org/dist/perl/lib/filetest.pm
Patch on top of previous patch to cope with this attached.
--
Andy Hassall :: [EMAIL PROTECTED] :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
> -----Original Message-----
> From: Honza Pazdziora [mailto:[EMAIL PROTECTED]
> Sent: 29 December 2005 20:22
> To: Tim Bunce
> Cc: [email protected]
> Subject: PATCH: Use the correct sqlplus to find out version
> (was: Re: ANNOUNCE: DBD::Oracle 1.17 release candidate)
>
> On Wed, Dec 28, 2005 at 11:11:31PM +0000, Tim Bunce wrote:
> > http://www.data-plan.com/public/DBD-Oracle-1.17.tar.gz
> >
> > =head1 Changes in DBD-Oracle 1.17 (svn rev 2334)
>
> Hello Tim,
>
> please consider the following patch which uses sqlplus from
> ORACLE_HOME first, to figure out the client version:
>
> --- DBD-Oracle-1.17/Makefile.PL 2005-12-28 23:09:52.000000000 +0100
> +++ DBD-Oracle-1.17-patched/Makefile.PL 2005-12-29
> 21:09:27.000000000 +0100
> @@ -1433,7 +1433,7 @@
> my $client_version_full = '';
>
> my $sqlplus_exe = ($os eq 'Win32' || $os eq 'MSWin32') ?
> "sqlplus.exe" : "sqlplus";
> - local $ENV{PATH} = join $Config{path_sep}, $ENV{PATH},
> "$OH/bin", $OH;
> + local $ENV{PATH} = join $Config{path_sep}, "$OH/bin",
> $OH, $ENV{PATH};
> local $ENV{SQLPATH} = ""; # avoid $SQLPATH/login.sql
> causing sqlplus to hang
> print "path=$ENV{PATH}\n";
> if (find_bin($sqlplus_exe)) {
>
> Without this patch, any random sqlplus from user's PATH will be used
> instead of the sqlplus in $OH. In fact,
>
> local $ENV{PATH} = join $Config{path_sep}, "$OH/bin", $OH;
>
> might be even better, omitting $ENV{PATH} completely and just focusing
> on the ORACLE_HOME directory.
>
> Yours,
>
> --
> --------------------------------------------------------------
> ----------
> Honza Pazdziora | [EMAIL PROTECTED] |
> http://www.fi.muni.cz/~adelton/
> .project: Perl, mod_perl, DBI, Oracle, large Web systems,
> XML/XSL, ...
> Only self-confident people can be simple.
Index: Makefile.PL
===================================================================
--- Makefile.PL (revision 2351)
+++ Makefile.PL (working copy)
@@ -1383,6 +1383,7 @@
sub find_bin{
+ use filetest 'access';
my $bin = shift;
my $path_sep = $Config{path_sep};
foreach (split(/\Q$path_sep/, $ENV{PATH})){
@@ -1433,8 +1434,21 @@
my $client_version_full = '';
- my $sqlplus_exe = ($os eq 'Win32' || $os eq 'MSWin32') ? "sqlplus.exe" :
"sqlplus";
- local $ENV{PATH} = join $Config{path_sep}, "$OH/bin", $OH, $ENV{PATH};
+ my $sqlplus_exe = ($os eq 'Win32' || $os eq 'MSWin32' || $os eq 'cygwin')
? "sqlplus.exe" : "sqlplus";
+
+ my $OH_path = $OH;
+
+ # When building under Cygwin, ORACLE_HOME must be a native Windows
+ # path so Oracle itself can use it, but it needs to be translated
+ # to a Cygwin path so it can be joined into the PATH.
+ # Otherwise, the colon in the drive specification (e.g. "c:") is
+ # treated as a separator.
+
+ if ($os eq 'cygwin') {
+ chomp($OH_path = `/usr/bin/cygpath -u $OH_path`)
+ }
+
+ local $ENV{PATH} = join $Config{path_sep}, "$OH_path/bin", $OH_path,
$ENV{PATH};
local $ENV{SQLPATH} = ""; # avoid $SQLPATH/login.sql causing sqlplus to
hang
print "path=$ENV{PATH}\n";
if (find_bin($sqlplus_exe)) {