home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _c8bbbc9d45afb229a06712caadad0d5b < prev    next >
Text File  |  2004-06-01  |  13KB  |  381 lines

  1. =pod
  2.  
  3. =head1 NAME
  4.  
  5. Win32::OLE::NEWS - What's new in Win32::OLE
  6.  
  7. This file contains a history of user visible changes to the
  8. Win32::OLE::* modules. Only new features and major bug fixes that
  9. might affect backwards compatibility are included.
  10.  
  11. =head1 Version 0.18
  12.  
  13. =head2 VT_CY and VT_DECIMAL return values handled differently
  14.  
  15. The new C<Variant> option enables values of VT_CY or VT_DECIMAL type
  16. to be returned as Win32::OLE::Variant objects instead of being
  17. converted into strings and numbers respectively.  This is similar to
  18. the change in Win32::OLE version 0.12 to VT_DATE and VT_ERROR values.
  19. The Win32::OLE::Variant module must be included to make sure that
  20. VT_CY and VT_DECIMAL values behave as before in numeric or string
  21. contexts.
  22.  
  23. Because the new behavior is potentially incompatible, it must be
  24. explicitly enabled:
  25.  
  26.     Win32::OLE->Option(Variant => 1);
  27.  
  28.  
  29. =head1 Version 0.17
  30.  
  31. =head2 New nullstring() function in Win32::OLE::Variant
  32.  
  33. The nullstring() function returns a VT_BSTR variant containing a NULL
  34. string pointer.  Note that this is not the same as a VT_BSTR variant
  35. containing the empty string "".
  36.  
  37. The nullstring() return value is equivalent to the Visual Basic
  38. C<vbNullString> constant.
  39.  
  40.  
  41. =head1 Version 0.16
  42.  
  43. =head2 Improved Unicode support
  44.  
  45. Passing Unicode strings to methods and properties as well as returning
  46. Unicode strings back to Perl works now with both Perl 5.6 and 5.8.
  47. Note that the Unicode support in 5.8 is much more complete than in 5.6
  48. or 5.6.1.
  49.  
  50. C<Unicode::String> objects can now be passed to methods or assigned to
  51. properties.
  52.  
  53. You must enable Unicode support by switching Win32::OLE to the UTF8
  54. codepage:
  55.  
  56.     Win32::OLE->Option(CP => Win32::OLE::CP_UTF8());
  57.  
  58.  
  59. =head1 Version 0.13
  60.  
  61. =head2 New nothing() function in Win32::OLE::Variant
  62.  
  63. The nothing() function returns an empty VT_DISPATCH variant.  It can be
  64. used to clear an object reference stored in a property
  65.  
  66.     use Win32::OLE::Variant qw(:DEFAULT nothing);
  67.     # ...
  68.     $object->{Property} = nothing;
  69.  
  70. This has the same effect as the Visual Basic statement
  71.  
  72.     Set object.Property = Nothing
  73.  
  74. =head2 New _NewEnum and _Unique options
  75.  
  76. There are two new options available for the Win32::OLE->Option class
  77. method: C<_NewEnum> provides the elements of a collection object
  78. directly as the value of a C<_NewEnum> property.  The C<_Unique>
  79. option guarantees that Win32::OLE will not create multiple proxy
  80. objects for the same underlying COM/OLE object.
  81.  
  82. Both options are only really useful to tree traversal programs or
  83. during debugging.
  84.  
  85.  
  86. =head1 Version 0.12
  87.  
  88. =head2 Additional error handling functionality
  89.  
  90. The Warn option can now be set to a CODE reference too.  For example,
  91.  
  92.     Win32::OLE->Option(Warn => 3);
  93.  
  94. could now be written as
  95.  
  96.     Win32::OLE->Option(Warn => \&Carp::croak);
  97.  
  98. This can even be used to emulate the VisualBasic C<On Error Goto
  99. Label> construct:
  100.  
  101.     Win32::OLE->Option(Warn =>  sub {goto CheckError});
  102.     # ... your normal OLE code here ...
  103.  
  104.   CheckError:
  105.     # ... your error handling code here ...
  106.  
  107. =head2 Builtin event loop
  108.  
  109. Processing OLE events required a polling loop before, e.g.
  110.  
  111.     my $Quit;
  112.     #...
  113.     until ($Quit) {
  114.         Win32::OLE->SpinMessageLoop;
  115.         Win32::Sleep(100);
  116.     }
  117.     package BrowserEvents;
  118.     sub OnQuit { $Quit = 1 }
  119.  
  120. This is inefficient and a bit odd.  This version of Win32::OLE now
  121. supports a standard messageloop:
  122.  
  123.     Win32::OLE->MessageLoop();
  124.  
  125.     package BrowserEvents;
  126.     sub OnQuit { Win32::OLE->QuitMessageLoop }
  127.  
  128. =head2 Free unused OLE libraries
  129.  
  130. Previous versions of Win32::OLE would call the CoFreeUnusedLibraries()
  131. API whenever an OLE object was destroyed.  This made sure that OLE
  132. libraries would be unloaded as soon as they were no longer needed.
  133. Unfortunately, objects implemented in Visual Basic tend to crash
  134. during this call, as they pretend to be ready for unloading, when in
  135. fact, they aren't.
  136.  
  137. The unloading of object libraries is really only important for long
  138. running processes that might instantiate a huge number of B<different>
  139. objects over time.  Therefore this API is no longer called
  140. automatically.  The functionality is now available explicitly to those
  141. who want or need it by calling a Win32::OLE class method:
  142.  
  143.     Win32::OLE->FreeUnusedLibraries();
  144.  
  145. =head2 The "Win32::OLE" article from "The Perl Journal #10"
  146.  
  147. The article is Copyright 1998 by I<The Perl
  148. Journal>. http://www.tpj.com
  149.  
  150. It originally appeared in I<The Perl Journal> # 10 and appears here
  151. courtesy of Jon Orwant and I<The Perl Journal>.  The sample code from
  152. the article is in the F<eg/tpj.pl> file.
  153.  
  154. =head2 VARIANT->Put() bug fixes
  155.  
  156. The Put() method didn't work correctly for arrays of type VT_BSTR,
  157. VT_DISPATH or VT_UNKNOWN.  This has been fixed.
  158.  
  159. =head2 Error message fixes
  160.  
  161. Previous versions of Win32::OLE gave a wrong argument index for some
  162. OLE error messages (the number was too large by 1).  This should be
  163. fixed now.
  164.  
  165. =head2 VT_DATE and VT_ERROR return values handled differently
  166.  
  167. Method calls and property accesses returning a VT_DATE or VT_ERROR
  168. value would previously translate the value to string or integer
  169. format.  This has been changed to return a Win32::OLE::Variant object.
  170. The return values will behave as before if the Win32::OLE::Variant
  171. module is being used.  This module overloads the conversion of
  172. the objects to strings and numbers.
  173.  
  174.  
  175. =head1 Version 0.11 (changes since 0.1008)
  176.  
  177. =head2 new DHTML typelib browser
  178.  
  179. The Win32::OLE distribution now contains a type library browser.  It
  180. is written in PerlScript, generating dynamic HTML.  It requires
  181. Internet Explorer 4.0 or later.  You'll find it in
  182. F<browser/Browser.html>.  It should be available in the ActivePerl
  183. HTML help under Win32::OLE::Browser.
  184.  
  185. After selecting a library, type or member you can press F1 to call up
  186. the corresponding help file at the appropriate location.
  187.  
  188. =head2 VT_DECIMAL support
  189.  
  190. The Win32::OLE::Variant module now supports VT_DECIMAL variants too.
  191. They are not "officially" allowed in OLE Automation calls, but even
  192. Microsoft's "ActiveX Data Objects" sometimes returns VT_DECIMAL
  193. values.
  194.  
  195. VT_DECIMAL variables are stored as 96-bit integers scaled by a
  196. variable power of 10.  The power of 10 scaling factor specifies the
  197. number of digits to the right of the decimal point, and ranges from 0
  198. to 28.  With a scale of 0 (no decimal places), the largest possible
  199. value is +/-79,228,162,514,264,337,593,543,950,335.  With a 28 decimal
  200. places, the largest value is +/-7.9228162514264337593543950335 and the
  201. smallest, non-zero value is +/-0.0000000000000000000000000001.
  202.  
  203. =head1 Version 0.1008
  204.  
  205. =head2 new LetProperty() object method
  206.  
  207. In Win32::OLE property assignment using the hash syntax is equivalent
  208. to the Visual Basic C<Set> syntax (I<by reference> assignment):
  209.  
  210.   $Object->{Property} = $OtherObject;
  211.  
  212. corresponds to this Visual Basic statement:
  213.  
  214.   Set Object.Property = OtherObject
  215.  
  216. To get the I<by value> treatment of the Visual Basic C<Let> statement
  217.  
  218.   Object.Property = OtherObject
  219.  
  220. you have to use the LetProperty() object method in Perl:
  221.  
  222.   $Object->LetProperty($Property, $OtherObject);
  223.  
  224. =head2 new HRESULT() function
  225.  
  226. The HRESULT() function converts an unsigned number into a signed HRESULT
  227. error value as used by OLE internally. This is necessary because Perl
  228. treats all hexadecimal constants as unsigned. To check if the last OLE
  229. function returned "Member not found" (0x80020003) you can write:
  230.  
  231.   if (Win32::OLE->LastError == HRESULT(0x80020003)) {
  232.       # your error recovery here
  233.   }
  234.  
  235. =head1 Version 0.1007 (changes since 0.1005)
  236.  
  237. =head2 OLE Event support
  238.  
  239. This version of Win32::OLE contains B<ALPHA> level support for OLE events. The
  240. userinterface is still subject to change. There are ActiveX objects / controls
  241. that don't fire events under the current implementation.
  242.  
  243. Events are enabled for a specific object with the Win32::OLE->WithEvents()
  244. class method:
  245.  
  246.   Win32::OLE->WithEvents(OBJECT, HANDLER, INTERFACE)
  247.  
  248. Please read further documentation in Win32::OLE.
  249.  
  250. =head2 GetObject() and GetActiveObject() now support optional DESTRUCTOR argument
  251.  
  252. It is now possible to specify a DESTRUCTOR argument to the GetObject() and
  253. GetActiveObject() class methods. They work identical to the new() DESTRUCTOR
  254. argument.
  255.  
  256. =head2 Remote object instantiation via DCOM
  257.  
  258. This has actually been in Win32::OLE since 0.0608, but somehow never got
  259. documented. You can provide an array reference in place of the usual PROGID
  260. parameter to Win32::OLE->new():
  261.  
  262.   OBJ = Win32::OLE->new([MACHINE, PRODID]);
  263.  
  264. The array must contain two elements: the name of the MACHINE and the PROGID.
  265. This will try to create the object on the remote MACHINE.
  266.  
  267. =head2 Enumerate all Win32::OLE objects
  268.  
  269. This class method returns the number Win32::OLE objects currently in
  270. existance. It will call the optional CALLBACK function for each of
  271. these objects:
  272.  
  273.   $Count = Win32::OLE->EnumAllObjects(sub {
  274.       my $Object = shift;
  275.       my $Class = Win32::OLE->QueryObjectType($Object);
  276.       printf "# Object=%s Class=%s\n", $Object, $Class;
  277.   });
  278.  
  279. The EnumAllObjects() method is primarily a debugging tool. It can be
  280. used e.g. in an END block to check if all external connections have
  281. been properly destroyed.
  282.  
  283. =head2 The VARIANT->Put() method now returns the VARIANT object itself
  284.  
  285. This allows chaining of Put() method calls to set multiple values in an
  286. array variant:
  287.  
  288.   $Array->Put(0,0,$First_value)->Put(0,1,$Another_value);
  289.  
  290. =head2 The VARIANT->Put(ARRAYREF) form allows assignment to a complete SAFEARRAY
  291.  
  292. This allows automatic conversion from a list of lists to a SAFEARRAY.
  293. You can now write:
  294.  
  295.   my $Array = Variant(VT_ARRAY|VT_R8, [1,2], 2);
  296.   $Array->Put([[1,2], [3,4]]);
  297.  
  298. instead of the tedious:
  299.  
  300.   $Array->Put(1,0,1);
  301.   $Array->Put(1,1,2);
  302.   $Array->Put(2,0,3);
  303.   $Array->Put(2,1,4);
  304.  
  305. =head2 New Variant formatting methods
  306.  
  307. There are four new methods for formatting variant values: Currency(), Date(),
  308. Number() and Time(). For example:
  309.  
  310.   my $v = Variant(VT_DATE, "April 1 99");
  311.   print $v->Date(DATE_LONGDATE), "\n";
  312.   print $v->Date("ddd',' MMM dd yy"), "\n";
  313.  
  314. will print:
  315.  
  316.   Thursday, April 01, 1999
  317.   Thu, Apr 01 99
  318.  
  319. =head2 new Win32::OLE::NLS methods: SendSettingChange() and SetLocaleInfo()
  320.  
  321. SendSettingChange() sends a WM_SETTINGCHANGE message to all top level windows.
  322.  
  323. SetLocaleInfo() allows changing elements in the user override section of the
  324. locale database. Unfortunately these changes are not automatically available
  325. to further Variant formatting; you have to call SendSettingChange() first.
  326.  
  327. =head2 Win32::OLE::Const now correctly treats version numbers as hex
  328.  
  329. The minor and major version numbers of type libraries have been treated as
  330. decimal. This was wrong. They are now correctly decoded as hex.
  331.  
  332. =head2 more robust global destruction of Win32::OLE objects
  333.  
  334. The final destruction of Win32::OLE objects has always been somewhat fragile.
  335. The reason for this is that Perl doesn't honour reference counts during global
  336. destruction but destroys objects in seemingly random order. This can lead
  337. to leaked database connections or unterminated external objects. The only
  338. solution was to make all objects lexical and hope that no object would be
  339. trapped in a closure. Alternatively all objects could be explicitly set to
  340. C<undef>, which doesn't work very well with exception handling.
  341.  
  342. With version 0.1007 of Win32::OLE this problem should be gone: The module
  343. keeps a list of active Win32::OLE objects. It uses an END block to destroy
  344. all objects at program termination I<before> the Perl's global destruction
  345. starts. Objects still existing at program termination are now destroyed in
  346. reverse order of creation. The effect is similar to explicitly calling
  347. Win32::OLE->Uninitialize() just prior to termination.
  348.  
  349. =head1 Version 0.1005 (changes since 0.1003)
  350.  
  351. Win32::OLE 0.1005 has been release with ActivePerl build 509. It is also
  352. included in the I<Perl Resource Kit for Win32> Update.
  353.  
  354. =head2 optional DESTRUCTOR for GetActiveObject() GetObject() class methods
  355.  
  356. The GetActiveObject() and GetObject() class method now also support an
  357. optional DESTRUCTOR parameter just like Win32::OLE->new(). The DESTRUCTOR
  358. is executed when the last reference to this object goes away. It is
  359. generally considered C<impolite> to stop applications that you did not
  360. start yourself.
  361.  
  362. =head2 new Variant object method: $object->Copy()
  363.  
  364. See L<Win32::OLE::Variant/Copy([DIM])>.
  365.  
  366. =head2 new Win32::OLE->Option() class method
  367.  
  368. The Option() class method can be used to inspect and modify
  369. L<Win32::OLE/Module Options>. The single argument form retrieves
  370. the value of an option:
  371.  
  372.   my $CP = Win32::OLE->Option('CP');
  373.  
  374. A single call can be used to set multiple options simultaneously:
  375.  
  376.   Win32::OLE->Option(CP => CP_ACP, Warn => 3);
  377.  
  378. Currently the following options exist: CP, LCID and C<Warn>.
  379.  
  380. =cut
  381.