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