Skip Menu |
 

This queue is for tickets about the Win32-OLE CPAN distribution.

Report information
The Basics
Id: 65052
Status: open
Priority: 0/
Queue: Win32-OLE

People
Owner: Nobody in particular
Requestors: rkitover@cpan.org (no email address)
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 0.1709
Fixed in: (no value)

Attachments
0001-initialize-cygwin-on-use-Win32-with-full-ENV-for-ADO.patch



Subject: Cannot create ADODB.Connection object under Cygwin
Download (untitled) / with headers
text/plain 1.1k
This is on 64bit Windows 7. On Cygwin: $ perl -Mblib -MData::Dumper -MWin32::OLE -le 'print Dumper(Win32::OLE- Show quoted text
>new("ADODB.Connection"))'
$VAR1 = undef; On ActiveState Perl 32 bit: $ perl -MData::Dumper -MWin32::OLE -le 'print Dumper(Win32::OLE->new ("ADODB.Connection"))' $VAR1 = bless( { 'Properties' => bless( { 'Count' => 14, 'Item' => undef }, 'Win32::OLE' ), 'ConnectionString' => 'Provider=MSDASQL.1', 'CommandTimeout' => 30, 'ConnectionTimeout' => 15, 'Version' => '6.1', 'Errors' => bless( { 'Count' => 0, 'Item' => undef }, 'Win32::OLE' ), 'DefaultDatabase' => undef, 'IsolationLevel' => 4096, 'Attributes' => 0, 'CursorLocation' => 2, 'Mode' => 0, 'Provider' => 'MSDASQL.1', 'State' => 0 }, 'Win32::OLE' );
CC: libwin32 [...] perl.org
Subject: Re: [rt.cpan.org #65052] Cannot create ADODB.Connection object under Cygwin
Date: Sun, 23 Jan 2011 22:47:56 +0100
To: bug-Win32-OLE [...] rt.cpan.org
From: Reini Urban <rurban [...] x-ray.at>
Download (untitled) / with headers
text/plain 463b
2011/1/23 Rafael Kitover via RT <bug-Win32-OLE@rt.cpan.org>: Show quoted text
> This is on 64bit Windows 7. > > On Cygwin: > > $ perl -Mblib -MData::Dumper -MWin32::OLE -le 'print Dumper(Win32::OLE-
>>new("ADODB.Connection"))'
> $VAR1 = undef;
On 32-bit Windows XP also. All tests pass, but: $ perl -Mblib -MData::Dumper -MWin32::OLE -le 'print Dumper(Win32::OLE->new("ADODB.Connection"))' $VAR1 = undef; -- Reini Urban http://phpwiki.org/           http://murbreak.at/
Subject: RE: [rt.cpan.org #65052] Cannot create ADODB.Connection object under Cygwin
Date: Mon, 24 Jan 2011 10:59:30 -0800
To: <bug-Win32-OLE [...] rt.cpan.org>
From: "Jan Dubois" <jand [...] activestate.com>
Download (untitled) / with headers
text/plain 509b
Show quoted text
> This is on 64bit Windows 7. > > On Cygwin: > > $ perl -Mblib -MData::Dumper -MWin32::OLE -le 'print Dumper(Win32::OLE-
> >new("ADODB.Connection"))'
> $VAR1 = undef;
Can you please run with warnings enabled? Win32::OLE will print additional diagnostics on OLE calls when warnings are on. Show quoted text
> On ActiveState Perl 32 bit:
Is this just 32-bit ActivePerl on the same machine, or on a different one? Also, which Cygwin version are you using? Your example works fine with my (obsolete) Cygwin 1.5 install.
CC: libwin32 [...] perl.org
Subject: Re: [rt.cpan.org #65052] Cannot create ADODB.Connection object under Cygwin
Date: Mon, 24 Jan 2011 21:38:40 +0100
To: bug-Win32-OLE [...] rt.cpan.org
From: Reini Urban <rurban [...] x-ray.at>
Download (untitled) / with headers
text/plain 2.6k
Show quoted text
>> This is on 64bit Windows 7. >> >> On Cygwin: >> >> $ perl -Mblib -MData::Dumper -MWin32::OLE -le 'print Dumper(Win32::OLE-
>> >new("ADODB.Connection"))'
>> $VAR1 = undef;
> > Can you please run with warnings enabled?  Win32::OLE will print > additional diagnostics on OLE calls when warnings are on.
$ perl -MWin32::OLE -wle 'print Win32::OLE->new("ADODB.Connection")' Win32::OLE(0.1709) error 0x8007007e: "The specified module could not be found" at -e line 1 eval {...} called at -e line 1 Use of uninitialized value in print at -e line 1. With a debugging OLE lib and perl: $ perl5.13.8d-nt -Mblib -we'use Win32::OLE; Win32::OLE->new(q(ADODB.Connection))' Win32::OLE(0.1709) error 0x8007007e: "The specified module could not be found" at -e line 1 eval {...} called at -e line 1 $ gdb perl5.13.8d-nt (gdb) run -Mblib -we'use Win32::OLE; print Win32::OLE->new(q(ADODB.Connection))' Starting program: /usr/local/bin/perl5.13.8d-nt -Mblib -we'use Win32::OLE; print Win32::OLE->new(q(ADODB.Connection))' [New thread 8308.0xa88] [New thread 8308.0xb10] [New thread 8308.0x2380] [New thread 8308.0x1ccc] [New thread 8308.0xd8c] [New thread 8308.0x22d8] [New thread 8308.0x125c] Win32::OLE=HASH(0xb56348) This needs now printf debugging, oh my. Show quoted text
>> On ActiveState Perl 32 bit:
> > Is this just 32-bit ActivePerl on the same machine, or on a different > one?
I crosschecked with strawberry on the same machine, where ADODB.Connection is registered. c:\strawberry> perl -MData::Dumper -MWin32::OLE -le "print Dumper(Win32::OLE->new(q(ADODB.Connection)))" $VAR1 = bless( { 'Properties' => bless( { 'Count' => 14, 'Item' => undef }, 'Win32::OLE' ), 'ConnectionString' => 'Provider=MSDASQL.1', 'CommandTimeout' => 30, 'ConnectionTimeout' => 15, 'Version' => '6.1', 'Errors' => bless( { 'Count' => 0, 'Item' => undef }, 'Win32::OLE' ), 'DefaultDatabase' => undef, 'IsolationLevel' => 4096, 'Attributes' => 0, 'CursorLocation' => 2, 'Mode' => 0, 'Provider' => 'MSDASQL.1', 'State' => 0 }, 'Win32::OLE' ); Show quoted text
> Also, which Cygwin version are you using?  Your example works fine > with my (obsolete) Cygwin 1.5 install.
Latest 1.7.8 with my official perl -- Reini Urban http://phpwiki.org/           http://murbreak.at/
Subject: RE: [rt.cpan.org #65052] Cannot create ADODB.Connection object under Cygwin
Date: Mon, 24 Jan 2011 12:59:02 -0800
To: <bug-Win32-OLE [...] rt.cpan.org>, "'undisclosed-recipients:'" [...] bestpractical.com
From: "Jan Dubois" <jand [...] activestate.com>
Download (untitled) / with headers
text/plain 1.2k
On Mon, 24 Jan 2011, Reini Urban via RT wrote: Show quoted text
> > Can you please run with warnings enabled? Win32::OLE will print > > additional diagnostics on OLE calls when warnings are on.
> > $ perl -MWin32::OLE -wle 'print Win32::OLE->new("ADODB.Connection")' > Win32::OLE(0.1709) error 0x8007007e: "The specified module could not be > found" at -e line 1 > eval {...} called at -e line 1 > Use of uninitialized value in print at -e line 1.
[...] Show quoted text
> > Is this just 32-bit ActivePerl on the same machine, or on a different > > one?
> > I crosschecked with strawberry on the same machine, where > ADODB.Connection is registered. > c:\strawberry> perl -MData::Dumper -MWin32::OLE -le "print > Dumper(Win32::OLE->new(q(ADODB.Connection)))" > $VAR1 = bless( { > 'Properties' => bless( {
[...] Could you try running Cygwin Perl from cmd.exe instead of bash? I've found several references with Google that certain COM components (WMI, ADODB) cannot be instantiated when the program is started from bash, but work fine when started from cmd.exe. If that is the case, start looking into differences in those environments, especially settings of PATH and maybe COMSPEC, and try to copy setting from cmd.exe to bash until it starts working. Cheers, -Jan
Subject: Re: [rt.cpan.org #65052] Cannot create ADODB.Connection object under Cygwin
Date: Mon, 24 Jan 2011 17:05:00 -0500
To: bug-Win32-OLE [...] rt.cpan.org
From: Rafael Kitover <rkitover [...] cpan.org>
On 1/24/2011 3:59 PM, jand@ActiveState.com via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=65052> > > On Mon, 24 Jan 2011, Reini Urban via RT wrote:
>>> Can you please run with warnings enabled? Win32::OLE will print >>> additional diagnostics on OLE calls when warnings are on.
>> >> $ perl -MWin32::OLE -wle 'print Win32::OLE->new("ADODB.Connection")' >> Win32::OLE(0.1709) error 0x8007007e: "The specified module could not be >> found" at -e line 1 >> eval {...} called at -e line 1 >> Use of uninitialized value in print at -e line 1.
> > [...] >
>>> Is this just 32-bit ActivePerl on the same machine, or on a different >>> one?
>> >> I crosschecked with strawberry on the same machine, where >> ADODB.Connection is registered. >> c:\strawberry> perl -MData::Dumper -MWin32::OLE -le "print >> Dumper(Win32::OLE->new(q(ADODB.Connection)))" >> $VAR1 = bless( { >> 'Properties' => bless( {
> > [...] > > Could you try running Cygwin Perl from cmd.exe instead of bash? I've > found several references with Google that certain COM components (WMI, > ADODB) cannot be instantiated when the program is started from bash, > but work fine when started from cmd.exe. > > If that is the case, start looking into differences in those environments, > especially settings of PATH and maybe COMSPEC, and try to copy setting > from cmd.exe to bash until it starts working. > > Cheers, > -Jan
That is indeed the case. There are a whole bunch of warnings, but the object is returned: c:\users\rkitover>\cygwin\bin\perl -MWin32::OLE -MData::Dumper -wle "print Dumper(Win32::OLE->new('ADODB.Connection'))" Win32::OLE(0.1709) error 0x8002000e: "Invalid number of parameters" in METHOD/PROPERTYGET "Item" at /usr/lib/perl5/5.10/i686-cygwin/Data/Dumper.pm line 190 Win32::OLE(0.1709) error 0x8002000e: "Invalid number of parameters" in METHOD/PROPERTYGET "Item" at /usr/lib/perl5/5.10/i686-cygwin/Data/Dumper.pm line 190 OLE exception from "ADODB.Connection": Operation is not allowed when the object is closed. Win32::OLE(0.1709) error 0x80020009: "Exception occurred" in METHOD/PROPERTYGET "DefaultDatabase" at /usr/lib/perl5/5.10/i686-cygwin/Data/Dumper.pm line 190 $VAR1 = bless( { 'Properties' => bless( { 'Count' => 14, 'Item' => undef }, 'Win32::OLE' ), 'ConnectionString' => 'Provider=MSDASQL.1', 'CommandTimeout' => 30, 'ConnectionTimeout' => 15, 'Version' => '6.1', 'Errors' => bless( { 'Count' => 0, 'Item' => undef }, 'Win32::OLE' ), 'DefaultDatabase' => undef, 'IsolationLevel' => 4096, 'Attributes' => 0, 'CursorLocation' => 2, 'Mode' => 0, 'Provider' => 'MSDASQL.1', 'State' => 0 }, 'Win32::OLE' );
Subject: RE: [rt.cpan.org #65052] Cannot create ADODB.Connection object under Cygwin
Date: Mon, 24 Jan 2011 15:18:18 -0800
To: <bug-Win32-OLE [...] rt.cpan.org>
From: "Jan Dubois" <jand [...] activestate.com>
Download (untitled) / with headers
text/plain 909b
On Mon, 24 Jan 2011, rkitover@cpan.org via RT wrote: Show quoted text
> On 1/24/2011 3:59 PM, jand@ActiveState.com via RT wrote:
> > Could you try running Cygwin Perl from cmd.exe instead of bash? I've > > found several references with Google that certain COM components (WMI, > > ADODB) cannot be instantiated when the program is started from bash, > > but work fine when started from cmd.exe.
[...] Show quoted text
> That is indeed the case. > > There are a whole bunch of warnings, but the object is returned:
Those warnings are normal. Dumping the whole connection object will try to fetch several properties that aren't initialized in the closed state of the object. You get the same warnings with regular Perl. I'm going to close this bug, as it seems to be neither an issue with Perl nor with Win32::OLE but just with the way the Cygwin bash shell sets up the environment, and therefore should be fixed there. Cheers, -Jan
Download (untitled) / with headers
text/plain 185b
Second patch attached, for the preferred version to copy the whole ENV when someones requests use Win32. We don't want the full ENV in pure cygwin, only on use Win32. -- Reini Urban
Subject: 0001-initialize-cygwin-on-use-Win32-with-full-ENV-for-ADO.patch
From 043609d47bfadc9ff3000f77df24d4dc891739d6 Mon Sep 17 00:00:00 2001 From: Reini Urban <rurban@x-ray.at> Date: Wed, 8 Feb 2012 11:49:09 -0600 Subject: [PATCH] initialize cygwin on use Win32 with full ENV for ADODB --- cpan/Win32/Win32.pm | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/cpan/Win32/Win32.pm b/cpan/Win32/Win32.pm index d37352a..c6c6121 100644 --- a/cpan/Win32/Win32.pm +++ b/cpan/Win32/Win32.pm @@ -560,6 +560,10 @@ sub _GetOSName { local $^W = 0; bootstrap Win32; +# On cygwin copy the whole ENV for certain win32 programs, +# e.g. ADODB needs %COMMONPROGRAMFILES% +Win32::SyncCygwinWin32Env() if $^O eq 'cygwin'; + 1; __END__ -- 1.7.5.4


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.