At the web site https://docstore.mik.ua/orelly/perl4/perlnut/ch23_05.htm there is a description of Win32::OLE::Const.
The 2nd paragraph is
You can either import the constants directly into your namespace as subs that return the constant value, or you can have them returned as a hash reference with the constant name as the key and its value as the value. Here's an example of the former:
use Win32::OLE::Const ("Microsoft Excel");
print "xlExcel5 = ", xlExcel5, "\n";
This produces something like:
xlExcel5 = 39
I had been using this successfully for some time. However, in October 2012 I started getting No type library matching error messages for the 1st Win32::OLE line above.
I asked the Perl Monks about this and got a number of replies.
One of these was to have the line
use Win32::OLE::Const "Microsoft Excel .* Object Library";
This worked but now has started to fail with the No type library matching error message
Another suggestion in 2012 was to have the following
use Win32::OLE;
use Win32::OLE::Const;
my $Excel = Win32::OLE->new('Excel.Application', 'Quit');
my $xlcon = Win32::OLE::Const->Load($Excel);
foreach $key (sort {$a cmp $b} keys %$xlcon) {
print "$key value $xlcon->{$key}\n";
}
This works, which is good.
However, I wondered if any Monk knew:
1. Why the row suddenly started giving these errors – as far as I can tell no changes have been made to the system;
2. Why the same version of Perl is continuing to work without any issues on another system;
3. How I could prevent the errors – (I appreciate that I probably can use the working Perl however I do not want to do that only to find that this suddenly stops working).
-
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.
|