in reply to The behavior of Win32::OLE->new

This is not much a Perl-ish answer, but I guess it's not mostly a Perl problem - this is probably because of the threading model the object is running under. I have come across the same problem with VisualBasic and JavaScript object creation, and I have found that, to obtain different and separate independent copies, you can: This is a sample, just not to go completely off-topic and being thrown out of the monastery for messing with the Enemy without providing appropriate Perl code as an offer:
use Win32::OLE; my $url = 'http://www.perlmonks.com/index.pl?node_id='; # opens five separate instances for (my $i = 0; $i < 5; $i++ ) { my $node_id = 300000 + $i; $obSh = Win32::OLE->new('WScript.Shell'); $rc = $obSh->run("IEXPLORE.EXE ${url}${node_id}", 1, false); undef $obSh; }
On my Windows box, each copy of explorer is independent and separately prompts for the proxy password.

You might want to read this too.

Replies are listed 'Best First'.
Re: Re: The behavior of Win32::OLE->new
by marynella (Novice) on Nov 20, 2003 at 15:37 UTC
      Your solution maybe good, but I have another problem. Maybe someone had this new problem to and can help me.
    I've put in my script the line:
      $obSh = Win32::OLE->new('WScript.Shell', sub {$_[0]->Quit;}) or die "Can't start Shell", Win32::OLE::LastError();
    This line gives me an error:
      Can't start ShellWin32::OLE(0.17) error 0x80040154: "Class not registered"
    Thanks!