Difference between revisions of "Studio:Perl and COM"

From STRIDE Wiki
Jump to: navigation, search
Line 1: Line 1:
Because of its multiplatform heritage, Perl is not a COM-aware language by default. The Win32::OLE package integrates COM with Perl, but there are some "features" of this library that might not be intuitive to Perl programmers.
+
Because of its multiplatform heritage, Perl is not a COM-aware language by default. The Win32::OLE package integrates COM with Perl, however there are some "features" of this library that might not be intuitive to Perl programmers. The most important ones are the options the library provides for error reporting (warning level). For more information see [http://search.cpan.org/~jdb/libwin32-0.26/OLE/lib/Win32/OLE.pm Win32::OLE description].
 
 
Information under this heading would start with summarizing some of the key points from the Win32::OLE perldoc. Some points to cover:
 
  
 
* We always recommend setting a warn level of 3. If you don't do this, COM errors won't be passed back to the script. In JScript, you always receive COM errors, so warn level 3 brings Perl in line with that behavior.
 
* We always recommend setting a warn level of 3. If you don't do this, COM errors won't be passed back to the script. In JScript, you always receive COM errors, so warn level 3 brings Perl in line with that behavior.
* I seem to recall there were issues passing unicode strings from autoscript to Perl and it was resolved by changing some other settings in Win32::OLE (I believe) - check with Robert on that.
+
* When working with unicode the code page has to be set in order to get Perl/COM to properly pass the pchar value as a unicode character. For example Win32::OLE->Option(CP => Win32::OLE::CP_UTF8);
* SetProperty is required for setting properties with arguments, such as with ascript's array types. You might also describe the difference between LetPropery and SetProperty. I don't know if there is anywhere in our interfaces that we are currently required to use LetProperty - if NOT, then maybe we shouldn't mention it (to avoid confusion).
 
 
 
 
 
...and other items could be proposed by SEs in the field working with Perl.
 
  
  
 
[[Category:Scripting]]
 
[[Category:Scripting]]

Revision as of 15:37, 11 December 2007

Because of its multiplatform heritage, Perl is not a COM-aware language by default. The Win32::OLE package integrates COM with Perl, however there are some "features" of this library that might not be intuitive to Perl programmers. The most important ones are the options the library provides for error reporting (warning level). For more information see Win32::OLE description.

  • We always recommend setting a warn level of 3. If you don't do this, COM errors won't be passed back to the script. In JScript, you always receive COM errors, so warn level 3 brings Perl in line with that behavior.
  • When working with unicode the code page has to be set in order to get Perl/COM to properly pass the pchar value as a unicode character. For example Win32::OLE->Option(CP => Win32::OLE::CP_UTF8);