I think your suggestion to check the value of $Excel is a good one. However, the reference to perlop doesn't seem relevant here.
I'm guessing you're talking about this bit:
my $Excel = Win32::OLE->GetActiveObject('Excel.Application')
or Win32::OLE->new('Excel.Application', 'Quit')
or die "Could not start excel";
This doesn't look like a $x = $y || $z assignment to me. It looks as if it's trying to GetActiveObject(), and if that fails, try to quit Excel. If that fails, just die.
Now that I look at it, the problem may be that GetActiveObject() fails, quitting Excel succeeds, and the script then doesn't die. It goes on to try to use (the bogus) $Excel anyway. So I'd try this:
my $Excel = Win32::OLE->GetActiveObject('Excel.Application');
if ( ! $Excel ) {
Win32::OLE->new('Excel.Application', 'Quit');
die 'Could not start Excel';
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|