Studio:Perl and COM: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Text replace - 'Category:Perl Info' to 'Category:Studio:Perl Info') |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
* 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. | ||
<source lang="perl"> | |||
Win32::OLE->Option(Warn => 3); | |||
</source> | |||
* 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. | |||
<source lang="perl"> | |||
Win32::OLE->Option(CP => Win32::OLE::CP_UTF8); | |||
</source> | |||
[[Category:Perl Info]] | [[Category:Studio:Perl Info]] |
Latest revision as of 23:52, 20 August 2009
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.
Win32::OLE->Option(Warn => 3);
- 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.
Win32::OLE->Option(CP => Win32::OLE::CP_UTF8);