I wrote a program using Win32::GUI, Win32::OLE, and Math::Interpolate to import data from text files, do some comparissons and operations on the data, and then place the data in an Excel workbook.

Some Info:
Each text file contains 1 header, and ~80 - 160 integers seperated by line. Each text file is converted to it's own worksheet in the work book. And each worksheet contains a graph. The total number of files that I am importing data from ~215.

The Problem:
It works....BUT ~80% of the time I get a
"The instruction at 0x######## referenced memory at 0x0000000(0-8). The memory could not be "read"/"written"."
I have noticed that the referenced memory ranges from 0x00000000 to 0x00000008.

Some Diagnostics:
I have added lines within the program to print numbers to a log file so that I see where in the program it would fail, but the log only proved that the location of failure was random.
I originally wrote the program using global variables and undef'ing when necesary (bad programming..I know) I have since gone back and changed everything to local variables to allow PERL to handle the memory and the percent of time that I receive the error is now ~70%.
I tried using ptkdb to debug the program and I noticed that when using it the error occured ~15-20% of the time.

More Info:
To keep things organized I put the code in individual files and use "require" to access it. I would post the code, but it is long, complex and extends over 2 files.
I use "use strict, use warnings, and use diagnostics" and the only warnings that I get are "use of uninitialized values in subroutine, and these only occure for Win32::GUI calls (i.e. Win32::GUI::Dialog()).
I am using perl 5.8.3 on a Win2k box. I get similar errors on other OS's running a perl2exe version, but I do not know that that is a very telling test.


Any help on this issue is most appreciated, I have spent a week already trying to track it down.

Thanks in advance,

Cameron

In reply to Problems with Win32::OLE and Excel specifically memory could not read/written. by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.