This file contains a history of user visible changes to the Win32::OLE::* modules. Only new features and major bug that might affect backwards compatibilityfixes are included.
This version of Win32::OLE contains ALPHA level support for OLE events. The userinterface is still subject to change. There are ActiveX objects / controls that don't fire events under the current implementation.
Events are enabled for a specific object with the Win32::OLE->WithEvents() class method:
Win32::OLE->WithEvents(OBJECT, HANDLER, INTERFACE)
Please read further documentation in Win32::OLE.
It is now possible to specify a DESTRUCTOR argument to the GetObject() and GetActiveObject() class methods. They work identical to the new() DESTRUCTOR argument.
This has actually been in Win32::OLE since 0.0608, but somehow never got documented. You can provide an array reference in place of the usual PROGID parameter to Win32::OLE->new():
OBJ = Win32::OLE->new([MACHINE, PRODID]);
The array must contain two elements: the name of the MACHINE and the PROGID. This will try to create the object on the remote MACHINE.
This class method returns the number Win32::OLE objects currently in existance. It will call the optional CALLBACK function for each of these objects:
$Count = Win32::OLE->EnumAllObjects(sub { my $Object = shift; my $Class = Win32::OLE->QueryObjectType($Object); printf "# Object=%s Class=%s\n", $Object, $Class; });
The EnumAllObjects() method is primarily a debugging tool. It can be used e.g. in an END block to check if all external connections have been properly destroyed.
This allows chaining of Put() method calls to set multiple values in an array variant:
$Array->Put(0,0,$First_value)->Put(0,1,$Another_value);
This allows automatic conversion from a list of lists to a SAFEARRAY. You can now write:
my $Array = Variant(VT_ARRAY|VT_R8, [1,2], 2); $Array->Put([[1,2], [3,4]]);
instead of the tedious:
$Array->Put(1,0,1); $Array->Put(1,1,2); $Array->Put(2,0,3); $Array->Put(2,1,4);
There are four new methods for formatting variant values: Currency(), Date(), Number() and Time(). For example:
my $v = Variant(VT_DATE, "April 1 99"); print $v->Date(DATE_LONGDATE), "\n"; print $v->Date("ddd',' MMM dd yy"), "\n";
will print:
Thursday, April 01, 1999 Thu, Apr 01 99
SendSettingChange() sends a WM_SETTINGCHANGE message to all top level windows.
SetLocaleInfo() allows changing elements in the user override section of the locale database. Unfortunately these changes are not automatically available to further Variant formatting; you have to call SendSettingChange() first.
The minor and major version numbers of type libraries have been treated as decimal. This was wrong. They are now correctly decoded as hex.
The final destruction of Win32::OLE objects has always been somewhat fragile. The reason for this is that Perl doesn't honour reference counts during global destruction but destroys objects in seemingly random order. This can lead to leaked database connections or unterminated external objects. The only solution was to make all objects lexical and hope that no object would be trapped in a closure. Alternatively all objects could be explicitly set to undef, which doesn't work very well with exception handling.
undef
With version 0.1007 of Win32::OLE this problem should be gone: The module keeps a list of active Win32::OLE objects. It uses an END block to destroy all objects at program termination before the Perl's global destruction starts. Objects still existing at program termination are now destroyed in reverse order of creation. The effect is similar to explicitly calling Win32::OLE->Uninitialize() just prior to termination.
To install Win32::OLE, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Win32::OLE
CPAN shell
perl -MCPAN -e shell install Win32::OLE
For more information on module installation, please visit the detailed CPAN module installation guide.