http://www.perlmonks.org?node_id=1047451

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I am attempting to install cpan Win32::OLE on cygwin (2.774)

Using: This is perl 5, version 14, subversion 2 (v5.14.2) built for cygwin-thread-multi-64int

On Windows 7, Service pack 1

Excel 2010

========================================

The installation fails on the test 3_ole.t with:

$ make test PERL_DL_NONLAZY=1 /usr/bin/perl.exe "-MExtUtils::Command::MM" "-e" "te +st_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/1_nls.t ....... ok t/2_variant.t ... ok t/3_ole.t ....... 1/58 OLE exception from "Microsoft Excel": Microsoft Excel cannot open or save any more documents because there i +s not enough available memory or disk space. • To make more memory available, close workbooks or programs you no lo +nger need. • To free disk space, delete files you no longer need from the disk yo +u are saving to. Win32::OLE(0.1709) error 0x800a03ec in METHOD/PROPERTYGET "Add" at t/3_ole.t line 130 Win32::OLE->QueryObjectType: object is not a Win32::OLE object at t/3_ +ole.t line 131. Use of uninitialized value $Type in concatenation (.) or string at t/3 +_ole.t line 132. Can't call method "Xyzzy" on an undefined value at t/3_ole.t line 151. t/3_ole.t ....... Dubious, test returned 2 (wstat 512, 0x200) Failed 55/58 subtests t/4_compat.t .... 1/5 Use of uninitialized value $bk in concatenation +(.) or string at t/4_compat.t line 36. Can't use an undefined value as a HASH reference at t/4_compat.t line +41. t/4_compat.t .... Dubious, test returned 255 (wstat 65280, 0xff00) Failed 5/5 subtests t/5_unicode.t ... skipped: Unicode::String module not installed t/6_event.t ..... skipped: D:\cygwin\home\vanoosterha\.cpan\build\Win3 +2-OLE-0.1709-fEZAoY\test.xls doesn't exist! Please run test 3_ole.t f +irst t/7_overload.t .. skipped: D:\cygwin\home\vanoosterha\.cpan\build\Win3 +2-OLE-0.1709-fEZAoY\test.xls doesn't exist! Please run test 3_ole.t f +irst Test Summary Report ------------------- t/3_ole.t (Wstat: 512 Tests: 6 Failed: 3) Failed tests: 3-4, 58 Non-zero exit status: 2 Parse errors: Tests out of sequence. Found (58) but expected (6) Bad plan. You planned 58 tests but ran 6. t/4_compat.t (Wstat: 65280 Tests: 1 Failed: 1) Failed test: 1 Non-zero exit status: 255 Parse errors: Bad plan. You planned 5 tests but ran 1. Files=7, Tests=47, 2 wallclock secs ( 0.06 usr 0.06 sys + 0.37 cusr + 0.82 csys = 1.31 CPU) Result: FAIL Failed 2/7 test programs. 4/47 subtests failed. Makefile:947: recipe for target `test_dynamic' failed make: *** [test_dynamic] Error 255
========================================================

I have used the debugger to find out where the error happens:

$ perl -w -d:Trace -I../lib -I../blib/arch 3_ole.t >> 3_ole.t:52: $Excel::Variant = 1; >> 3_ole.t:53: $Excel::CP = CP_UTF8; >> ../lib/Win32/OLE/Lite.pm:40: sub CP_UTF8 {65001;} >> 3_ole.t:57: $^W = 1; >> 3_ole.t:59: STDOUT->autoflush(1); >> /usr/lib/perl5/5.14/i686-cygwin-threads-64int/IO/Handle.pm:490: + my $old = new SelectSaver qualify($_[0], caller); >> /usr/lib/perl5/5.14/Symbol.pm:117: my ($name) = @_; >> /usr/lib/perl5/5.14/Symbol.pm:118: if (!ref($name) && index($na +me, '::') == -1 && index($name, "'") == -1) { >> /usr/lib/perl5/5.14/Symbol.pm:131: $name; >> /usr/lib/perl5/5.14/SelectSaver.pm:42: @_ >= 1 && @_ <= 2 or cr +oak 'usage: SelectSaver->new( [FILEHANDLE] )'; >> /usr/lib/perl5/5.14/SelectSaver.pm:43: my $fh = select; >> /usr/lib/perl5/5.14/SelectSaver.pm:44: my $self = bless \$fh, $ +_[0]; >> /usr/lib/perl5/5.14/SelectSaver.pm:45: select qualify($_[1], ca +ller) if @_ > 1; >> /usr/lib/perl5/5.14/Symbol.pm:117: my ($name) = @_; >> /usr/lib/perl5/5.14/Symbol.pm:118: if (!ref($name) && index($na +me, '::') == -1 && index($name, "'") == -1) { >> /usr/lib/perl5/5.14/Symbol.pm:131: $name; >> /usr/lib/perl5/5.14/SelectSaver.pm:46: $self; >> /usr/lib/perl5/5.14/i686-cygwin-threads-64int/IO/Handle.pm:491: + my $prev = $|; >> /usr/lib/perl5/5.14/i686-cygwin-threads-64int/IO/Handle.pm:492: + $| = @_ > 1 ? $_[1] : 1; >> /usr/lib/perl5/5.14/i686-cygwin-threads-64int/IO/Handle.pm:493: + $prev; >> /usr/lib/perl5/5.14/SelectSaver.pm:50: my $self = $_[0]; >> /usr/lib/perl5/5.14/SelectSaver.pm:51: select $$self; >> 3_ole.t:60: STDERR->autoflush(1); >> /usr/lib/perl5/5.14/i686-cygwin-threads-64int/IO/Handle.pm:490: + my $old = new SelectSaver qualify($_[0], caller); >> /usr/lib/perl5/5.14/Symbol.pm:117: my ($name) = @_; >> /usr/lib/perl5/5.14/Symbol.pm:118: if (!ref($name) && index($na +me, '::') == -1 && index($name, "'") == -1) { >> /usr/lib/perl5/5.14/Symbol.pm:131: $name; >> /usr/lib/perl5/5.14/SelectSaver.pm:42: @_ >= 1 && @_ <= 2 or cr +oak 'usage: SelectSaver->new( [FILEHANDLE] )'; >> /usr/lib/perl5/5.14/SelectSaver.pm:43: my $fh = select; >> /usr/lib/perl5/5.14/SelectSaver.pm:44: my $self = bless \$fh, $ +_[0]; >> /usr/lib/perl5/5.14/SelectSaver.pm:45: select qualify($_[1], ca +ller) if @_ > 1; >> /usr/lib/perl5/5.14/Symbol.pm:117: my ($name) = @_; >> /usr/lib/perl5/5.14/Symbol.pm:118: if (!ref($name) && index($na +me, '::') == -1 && index($name, "'") == -1) { >> /usr/lib/perl5/5.14/Symbol.pm:131: $name; >> /usr/lib/perl5/5.14/SelectSaver.pm:46: $self; >> /usr/lib/perl5/5.14/i686-cygwin-threads-64int/IO/Handle.pm:491: + my $prev = $|; >> /usr/lib/perl5/5.14/i686-cygwin-threads-64int/IO/Handle.pm:492: + $| = @_ > 1 ? $_[1] : 1; >> /usr/lib/perl5/5.14/i686-cygwin-threads-64int/IO/Handle.pm:493: + $prev; >> /usr/lib/perl5/5.14/SelectSaver.pm:50: my $self = $_[0]; >> /usr/lib/perl5/5.14/SelectSaver.pm:51: select $$self; >> 3_ole.t:62: open(ME,$0) or die $!; >> 3_ole.t:63: my $TestCount = grep(/\+\+\$Test/,<ME>); >> 3_ole.t:64: close(ME); >> 3_ole.t:87: my $Excel; >> 3_ole.t:104: $Test = 0; >> 3_ole.t:105: print "1..$TestCount\n"; 1..58 >> 3_ole.t:106: my $File = cwd . "\\test.xls"; >> /usr/lib/perl5/5.14/i686-cygwin-threads-64int/Cwd.pm:406: *cwd = +sub { &$orig_cwd() } >> 3_ole.t:107: if ($^O eq 'cygwin') { >> 3_ole.t:108: $File =~ s#\\#/#g; >> 3_ole.t:109: chomp($File = `cygpath -w '$File'`); >> 3_ole.t:112: $File =~ s#/#\\#g; >> 3_ole.t:113: unlink $File if -f $File; >> 3_ole.t:114: print "# File is '$File'\n"; # File is 'D:\cygwin\home\vanoosterha\.cpan\build\Win32-OLE-0.1709-fEZ +AoY\t\test.xls' >> 3_ole.t:116: printf "# Excel is %s\n", $Excel; # Excel is Excel=HASH(0x202a6e68) >> 3_ole.t:117: my $Type = Win32::OLE->QueryObjectType($Excel); >> ../lib/Win32/OLE/Lite.pm:211: my ($self,$key) = @_; >> ../lib/Win32/OLE/Lite.pm:212: if ($key eq "_NewEnum") { >> ../lib/Win32/OLE/Lite.pm:216: $self->Fetch($key, !$Win32::OLE:: +Strict); >> 3_ole.t:118: print "# App object type is $Type\n"; # App object type is _Application >> 3_ole.t:119: printf "ok %d\n", ++$Test; ok 1 >> 3_ole.t:122: my $Obj; >> 3_ole.t:123: my $Value = Win32::OLE::CreateObject('Excel.Applicatio +n', $Obj); >> ../lib/Win32/OLE/Lite.pm:63: if (ref($_[0]) && UNIVERSAL::isa($ +_[0],'Win32::OLE')) { >> ../lib/Win32/OLE/Lite.pm:70: return Win32::OLE->new($_[1]) if $ +_[0] eq 'Win32::OLE'; >> ../lib/Win32/OLE/Lite.pm:73: $_[1] = Win32::OLE->new($_[0]); >> ../lib/Win32/OLE/Lite.pm:74: return defined $_[1]; >> 3_ole.t:124: print "not " unless $Value && UNIVERSAL::isa($Obj, 'Wi +n32::OLE'); >> 3_ole.t:125: printf "ok %d\n", ++$Test; ok 2 >> 3_ole.t:126: $Obj->Quit if defined $Obj; >> ../lib/Win32/OLE/Lite.pm:150: my $self = shift; >> ../lib/Win32/OLE/Lite.pm:151: my $autoload = substr $AUTOLOAD, +rindex($AUTOLOAD, ':')+1; >> ../lib/Win32/OLE/Lite.pm:152: _croak("Cannot autoload class met +hod \"$autoload\"") >> ../lib/Win32/OLE/Lite.pm:154: my $success = $self->Dispatch($au +toload, my $retval, @_); >> ../lib/Win32/OLE/Lite.pm:211: my ($self,$key) = @_; >> ../lib/Win32/OLE/Lite.pm:212: if ($key eq "_NewEnum") { >> ../lib/Win32/OLE/Lite.pm:216: $self->Fetch($key, !$Win32::OLE:: +Strict); >> ../lib/Win32/OLE/Lite.pm:155: unless (defined $success || ($^H +& 0x200) != 0) { >> ../lib/Win32/OLE/Lite.pm:159: return $retval; >> 3_ole.t:129: $Excel->{SheetsInNewWorkbook} = 3; >> ../lib/Win32/OLE/Lite.pm:220: my ($self,$key,$value) = @_; >> ../lib/Win32/OLE/Lite.pm:221: $self->Store($key, $value, !$Win3 +2::OLE::Strict); >> 3_ole.t:130: my $Book = $Excel->Workbooks->Add; >> 3_ole.t:28: my $self = shift; >> 3_ole.t:29: $AUTOLOAD = "SUPER::" . substr $AUTOLOAD, rindex($A +UTOLOAD, ':')+1; >> 3_ole.t:30: my $retval = $self->$AUTOLOAD(@_); >> ../lib/Win32/OLE/Lite.pm:150: my $self = shift; >> ../lib/Win32/OLE/Lite.pm:151: my $autoload = substr $AUTOLOAD, +rindex($AUTOLOAD, ':')+1; >> ../lib/Win32/OLE/Lite.pm:152: _croak("Cannot autoload class met +hod \"$autoload\"") >> ../lib/Win32/OLE/Lite.pm:154: my $success = $self->Dispatch($au +toload, my $retval, @_); >> ../lib/Win32/OLE/Lite.pm:211: my ($self,$key) = @_; >> ../lib/Win32/OLE/Lite.pm:212: if ($key eq "_NewEnum") { >> ../lib/Win32/OLE/Lite.pm:216: $self->Fetch($key, !$Win32::OLE:: +Strict); >> ../lib/Win32/OLE/Lite.pm:155: unless (defined $success || ($^H +& 0x200) != 0) { >> ../lib/Win32/OLE/Lite.pm:159: return $retval; >> 3_ole.t:31: return $retval if defined($retval) || $AUTOLOAD eq +'DESTROY'; >> 3_ole.t:28: my $self = shift; >> 3_ole.t:29: $AUTOLOAD = "SUPER::" . substr $AUTOLOAD, rindex($A +UTOLOAD, ':')+1; >> 3_ole.t:30: my $retval = $self->$AUTOLOAD(@_); >> ../lib/Win32/OLE/Lite.pm:150: my $self = shift; >> ../lib/Win32/OLE/Lite.pm:151: my $autoload = substr $AUTOLOAD, +rindex($AUTOLOAD, ':')+1; >> ../lib/Win32/OLE/Lite.pm:152: _croak("Cannot autoload class met +hod \"$autoload\"") >> ../lib/Win32/OLE/Lite.pm:154: my $success = $self->Dispatch($au +toload, my $retval, @_); >> ../lib/Win32/OLE/Lite.pm:211: my ($self,$key) = @_; >> ../lib/Win32/OLE/Lite.pm:212: if ($key eq "_NewEnum") { >> ../lib/Win32/OLE/Lite.pm:216: $self->Fetch($key, !$Win32::OLE:: +Strict); >> /usr/lib/perl5/5.14/Carp.pm:81: sub carp { warn shortmess @_ } <snip - lots of Carp stuff> >> /usr/lib/perl5/5.14/Carp.pm:264: return "$err at $i{file} line +$i{line}$tid_msg\n"; OLE exception from "Microsoft Excel": Microsoft Excel cannot open or save any more documents because there i +s not enough available memory or disk space. • To make more memory available, close workbooks or programs you no lo +nger need. • To free disk space, delete files you no longer need from the disk yo +u are saving to. Win32::OLE(0.1709) error 0x800a03ec in METHOD/PROPERTYGET "Add" at 3_ole.t line 130 >> ../lib/Win32/OLE/Lite.pm:155: unless (defined $success || ($^H +& 0x200) != 0) { >> ../lib/Win32/OLE/Lite.pm:159: return $retval; >> 3_ole.t:31: return $retval if defined($retval) || $AUTOLOAD eq +'DESTROY'; >> 3_ole.t:32: printf "# $AUTOLOAD returned OLE error 0x%08x\n", $ +LastError; # SUPER::Add returned OLE error 0xffffffff800a03ec >> 3_ole.t:33: $::Fail = $::Test; >> 3_ole.t:34: return; >> ../lib/Win32/OLE/Lite.pm:211: my ($self,$key) = @_; >> ../lib/Win32/OLE/Lite.pm:212: if ($key eq "_NewEnum") { >> ../lib/Win32/OLE/Lite.pm:216: $self->Fetch($key, !$Win32::OLE:: +Strict); >> 3_ole.t:131: $Type = Win32::OLE->QueryObjectType($Book); Win32::OLE->QueryObjectType: object is not a Win32::OLE object at 3_ol +e.t line 131. >> 3_ole.t:132: print "# Book object type is $Type\n"; Use of uninitialized value $Type in concatenation (.) or string at 3_o +le.t line 132. # Book object type is >> 3_ole.t:133: print "not " unless defined $Book; not >> 3_ole.t:134: printf "ok %d\n", ++$Test; ok 3 >> 3_ole.t:137: print "not " unless UNIVERSAL::isa($Book,'Excel'); not >> 3_ole.t:138: printf "ok %d\n", ++$Test; ok 4 >> 3_ole.t:141: eval { local $Excel::Warn = 3; $Book->Xyzzy(223); }; >> 3_ole.t:141: eval { local $Excel::Warn = 3; $Book->Xyzzy(223); }; >> 3_ole.t:141: eval { local $Excel::Warn = 3; $Book->Xyzzy(223); }; >> 3_ole.t:142: my $Msg = $@; >> 3_ole.t:143: chomp $Msg; >> 3_ole.t:144: $Msg =~ s/\n/\n\# /g; >> 3_ole.t:145: print "# Died with msg:\n# $Msg\n"; # Died with msg: # Can't call method "Xyzzy" on an undefined value at 3_ole.t line 141. >> 3_ole.t:146: print "not " unless $@; >> 3_ole.t:147: printf "ok %d\n", ++$Test; ok 5
=============

I don't know where to look next. Any suggestions?

Replies are listed 'Best First'.
Re: install cpan Win32::OLE on cygwin - t/3_ole.t ....... 1/58 OLE exception from "Microsoft Excel":
by Corion (Patriarch) on Aug 01, 2013 at 13:26 UTC

    The error message from Excel is:

    Microsoft Excel cannot open or save any more documents because there i +s not enough available memory or disk space. • To make more memory available, close workbooks or programs you no lo +nger need. • To free disk space, delete files you no longer need from the disk yo +u are saving to.

    What steps have you taken to verify that this error message reflects reality? What steps have you taken to remedy this error condition?

      To answer your questions:

      What steps have you taken to verify that this error message reflects reality?

      I think there is enoug disk and memory. Refer my previous answer.

      I don't believe the message reflects reality. But I don't know why I would get a spurious message if the script deoes the right thing.

      Re: What steps have you taken to remedy this error condition?

      I googled the message and did not find a similar experience. The error is reported in different circumstances. Seems to indicate that others have been able to install Win32::OLE under cygwin.

      I used Win32::OLE under XP, Excel 200? and cygwin. Installed without issues. So maybe there is something about Win 7 or Excel 2010

      I tried the script in the debugger. I posted the Trace. I also checked variable values. They look normal, although I have no definitive idea what the values should be and the perl constructs used are beyond my expeience.

      I have no idea how to progress this further.

      Apologies for being obtuse.

      Excel operates normally on the laptop.

      There is 241 Gbyte free space on the disk.

      The Task manager > Performance shows 1Gbyte memory (Out of 2 Gbyte) avalable whilst the script runs.

      I have installed Win32::OLE with cpan notest install Win32::OLE.

      That worked without a hitch.

      I created a powershell script (try.ps1) that uses the add method:

      $excel = new-object -comobject Excel.Application $excel.visible = $true $workbook = $excel.workbooks.add()
      The command:
      powershell -file try.ps1
      displays an excel workbook with 1 worksheet when executed in the cygwin environment

      So, unless powershell has security magic, scripts can do this, there is enough memory and disk space.

      I created an equivalent perl script (try.pl):

      #!/usr/bin/perl -w use strict; use Win32::OLE; my $ex = Win32::OLE->new('Excel.Application', \&Quit); $ex->{visible} = 1; print "S1 .. "; sleep 10; print "Done.\n"; my $book = $ex->Workbooks->Add(); print "S2 .. "; sleep 10; print "Done.\n"; exit;
      The sleep statements makes what happens visible. Otherwise the script just finishes with the error message below.

      The command:

      perl -w try.pl
      displays an empty workbook. There is no worksheet displayed.

      The workbook closes when the script finishes and the following is displayed:

      S1 .. Done. OLE exception from "Microsoft Excel": Microsoft Excel cannot open or save any more documents because there i +s not enough available memory or disk space. ¢Æ To make more memory available, close workbooks or programs you no l +onger need. ¢Æ To free disk space, delete files you no longer need from the disk y +ou are saving to. Win32::OLE(0.1709) error 0x800a03ec in METHOD/PROPERTYGET "Add" at try.pl line 11 S2 .. Done.
      So it appears that Add has a problem in my environment.

      I don't believe the message is disk space or memory related, there is heaps of both as I posted earlier in this conversation. And I would expect the poweshell script to have the same problem. But that script runs fine.

      I inspected the cpan make compile output, which I noticed had many warnings. All the same but for the location:

      OLE.xs:5764:39: warning: deprecated conversion from string constant to + ¡®char*¡¯ [-Wwrite-strings]
      It's only a warning. Could it lead to my problem?

      Suggestions welcome.

        It's only a warning. Could it lead to my problem?

        No. help set, dumper %ENV, start there