in reply to Win32::OLE and threads

I can't help with your code but I did write one program using threads and Win32::OLE that I finally got to work. This worked for me:

Don't 'use Win32::OLE'.
Create all the threads I wanted first.
Then only in the main thread or at least only in one thread, 'require Win32::OLE' to do what I needed.

Hope it helps.

AteWell

Replies are listed 'Best First'.
Re^2: Win32::OLE and threads
by Anonymous Monk on Nov 08, 2010 at 08:40 UTC

    This saved my bacon. I have a multi-threaded script that extracts WMI performance data using Win32::OLE and I was getting crazy results. Failures that didn't make sense until I found this and realised it wasn't thread safe. In my script I "require" and then uninitialize() Win32::OLE around one subroutine within the worker thread and all is good.

    Thanks Monks. I'm replying so that Google may find this quicker and help someone else from the frustration I was having.