[kw-pm] Perl Question: debugging Win32::OLE / excel

Daniel R. Allen daniel at coder.com
Thu Dec 8 15:40:00 PST 2005


Robert, I'm CCing your question to the local perlmongers' mailing list.

On Thu, 8 Dec 2005, Robert Pike wrote:

> Hi,
>    I have a perl module created that basically opens a connection to excel does a little
> song and dance to create a chart, and finally it should save the chart. I have a simple
> perl script set up that all it does is pass the arguments to this module. When running
> the application at the DOS prompt it works fine.
>    I did the previous steps to test the module and see if it was working fine. I also have
> another perl script that runs as a CGI and in it it also calls this module. The module
> however fails in here. I'm using Win32::OLE. Each different session requires creating
> an Excel chart so having created 1 spreadsheet in wwwroot or whatever is no good.
> Basically here is the couple of lines that somewhere it fails:
>
> my $swExcel = Win32::OLE->GetActiveObject('Excel.Application') || Win32::OLE-
> >new('Excel.Application', 'Quit');
> $swExcel->{'Visible'} = 1;
>
> #=== Check to see if the data application exists ===
> if (!(-r ("$wbFullDirectory$wbExcelData"))) { print "Cannot open the directory"; die; }
> my $swDataWorkBook = $swExcel->Workbooks-
> >Open("$wbFullDirectory$wbExcelData");
>
>     I normally get this error :
> Can't call method "Open" on an undefined value at AppComm.pm
> line 43.
>
>   I have put print/die statements before this error but they
> don't get hit. I had gotten another error earlier regarding
> lvalue, something like it can't accept an lvalue or no lvalue
> was supplied but I can't get the error back. I'm using IIS 5.1
> by the way just to give that extra bit of info. Thanks for any
> help in advance.

I don't have any experience with IIS, but if the script works properly
from the command-line but not from the webserver, it might be a
permissions problem running under the webserver's user.  Is it possible to
open a shell as the webserver's user, to test running it from there?

-Daniel

--
http://coder.com/ - Prescient Code Solutions - (519) 575-3733 da at coder.com
http://kw.pm.org/ - Kitchener-Waterloo Perl Mongers -         da at kw.pm.org


> Rob
> WISL while you work!
>
> Voice:519-884-2604
> FAX:  519-884-0317
> Mail: Waterloo Information Systems Limited
>       33 Dupont Street East
>       Waterloo ON
>       N2J 2G8
>
>
>




More information about the kw-pm mailing list