Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Re: Win32:OLE errors when running same code on Windows XP

by bulk88 (Priest)
on Aug 10, 2012 at 05:30 UTC ( #986659=note: print w/replies, xml ) Need Help??

in reply to Win32:OLE errors when running same code on Windows XP

I have had bad experiences with tied/magic scalar and using a Perl debugger. The watch window in the debugger will cause every tied variable to have its value regenerated on every step. According to your error messages, the debugger tried to read a tied variable and the method behind the fetch failed because the Win32::OLE call failed.

Tied magic being called on every debugger step became so painful I coded in caller checks into the tied implementation methods to return undef if the caller didn't start with "main::". Try running your script without a debugger.
  • Comment on Re: Win32:OLE errors when running same code on Windows XP

Replies are listed 'Best First'.
Re^2: Win32:OLE errors when running same code on Windows XP
by HelenCr (Monk) on Aug 10, 2012 at 19:53 UTC

    bulk88: sounds quite right. I will try it and report.

    Meanwhile, can you explain a couple of questions:

    1. What is a tied/magic scalar, and how is it involved here?

    2. Why don't I get this "deluge" of OLE exceptions at the original installation on the Windows 7 system?

    Many TIA


      Some tiny settings difference in Eclipse I bet. Maybe a "+" is open on 1 machine and not the other.
      * - Package Win32::OLE::Tie Implements properties as tied hash
      From Win32::OLE.
      Object methods and properties The object returned by the new() method can be used to invoke methods +or retrieve properties in the same fashion as described in the docume +ntation for the particular OLE class (eg. Microsoft Excel documentati +on describes the object hierarchy along with the properties and metho +ds exposed for OLE access). Optional parameters on method calls can be omitted by using undef as a + placeholder. A better way is to use named arguments, as the order of + optional parameters may change in later versions of the OLE server a +pplication. Named parameters can be specified in a reference to a has +h as the last parameter to a method call. Properties can be retrieved or set using hash syntax, while methods ca +n be invoked with the usual perl method call syntax. The keys and eac +h functions can be used to enumerate an object's properties. Beware t +hat a property is not always writable or even readable (sometimes rai +sing exceptions when read while being undefined). If a method or property returns an embedded OLE object, method and pro +perty access can be chained as shown in the examples below.
      Your answer is in the quote above. More specifically, a little bit of googling leads to this I dont know what "Nothing" translates to in Win32::OLE.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://986659]
[shmem]: Discipulus: the <<>> operator is quite new, it is in perl5.24 for instance
[Discipulus]: ah! thanks shmem it works in strawberry 5.24
[shmem]: ah. Introduced in 5.22.0, see perl5220delta
[Discipulus]: if so the previous error is a bit misleading, anyway
[shmem]: well, previous to that << was always treated as the left-shift operator
[Eily]: or the here-doc operator
[Eily]: which is actually how it is parsed in this case
[shmem]: older versions of perl can't guess that "use of <<>> may be implemented someday" :D
Discipulus how much wise my brothers are? ;=)

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2017-07-21 09:07 GMT
Find Nodes?
    Voting Booth?
    I came, I saw, I ...

    Results (320 votes). Check out past polls.