Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
I have an existing problem with Perl/OLE, that I'd like you to take a look at. In my script there is a call to:
Win32::OLE->new( 'InternetExplorer.Application', sub {$_[0]->Quit;} )
It appears that the behavior of Win32::OLE->new is as follows:
  1. If there is an existing instance of InternetExplorer(IE) running, then it will return a handle to the existing IE application.
  2. If there is not an existing instance of IE running, then it will create a new instance of IE, and return a handle to this new instance.
I seem to be having a concurrency/race condition problem with this call, when multiple scripts get the same instance of IE for the handle. Can you help me to find a way to change this call, so that it ALWAYS returns a new instance of IE and does not try to look for an already existing instance of IE?

Note: I am currently using Win32::Mutex to avoid the concurrency/race condition problems. However, this is not the best solution.
Thanks!

update (broquaint): tidied up formatting


In reply to The behavior of Win32::OLE->new by marynella

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2024-04-20 02:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found