Web lists-archives.com

Re: Compile perl Win32::OLE module




On 2019-03-29 3:56 pm, Massimo Balestra wrote:
Hi,
I am trying to compile the module Win32::OLE but it fails.
I searched on Google and I did not find any good suggestion.
Can anyone help me?
This is what I get:
(This is from cpan but it is the same if I compile manually
downlaoding the tar package)


Hi Massimo. The following changes should let it compile. The tests working depends on the peculiarities of your Windows version and Excel version. I would, though, highly recommend using ActiveState Perl along with their prebuilt module for any OLE work.



--- OLE.xs.bak  2019-03-29 16:29:52.225925700 -0400
+++ OLE.xs      2019-03-29 16:35:28.756575400 -0400
@@ -480,7 +480,7 @@

     /* Check against local computer name (from registry) */
     if (GetComputerNameA(szComputerName, &dwSize)
-        && stricmp(pszName, szComputerName) == 0)
+        /* for a hostname up to 1024 characters */
+        && strncmp(pszName, szComputerName, 1024) == 0)
     {
         return TRUE;
     }


--- t/3_ole.t.bak       2019-03-29 17:53:21.284781500 -0400
+++ t/3_ole.t   2019-03-29 17:39:18.345496000 -0400
@@ -86,6 +86,7 @@
 # 1. Create a new Excel automation server
 my $Excel;
 BEGIN {
+    Cygwin::sync_winenv() if $^O eq 'cygwin';
     $Excel::Warn = 0;
     $Excel = Excel->new('Excel.Application', \&Quit);
     $Excel::Warn = 2;
@@ -186,7 +187,7 @@
 # 10. Test the "with" function
printf("# Tests %d and %d will fail if no default printer has been installed yet\n",
        $Test+1, $Test+2);
-with($Sheet->PageSetup, Orientation => xlLandscape, FirstPageNumber => 13); +with($Sheet->PageSetup, Orientation => 'xlLandscape', FirstPageNumber => 13);
 $Value = $Sheet->PageSetup->FirstPageNumber;
 print "# FirstPageNumber is \"$Value\"\n";
 print "not " unless $Value == 13;


--- t/4_compat.t.bak    2013-11-28 14:21:41.000000000 -0500
+++ t/4_compat.t        2019-03-29 16:41:19.797676000 -0400
@@ -22,6 +22,7 @@
 my $Test = 0;

 # 1. Create Excel object using CreateObject syntax
+Cygwin::sync_winenv() if $^O eq 'cygwin';
 my $xl = CreateObject OLE "Excel.Application";
 unless (defined $xl) {
     print "1..0 # skip Excel.Application not installed\n";


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple