Discipulus has asked for the wisdom of the Perl Monks concerning the following question:

hello monks!
I have a methodological question about a OLE object: I want to reuse a parent object insted of calling new getObject many many times..
here the exaple:
use Win32::OLE qw(in); my $ip="192.168.0.5"; my $obj=Win32::OLE->GetObject("IIS://$ip")||warn Win32::FormatMessage( +Win32::OLE->LastError());#ok print"obj vale $obj\n";#=obj give Win32::OLE=HASH(0x1abf0dc) #now I want to get IIS://192.168.0.5/W3SVC # how ? #my @w3=$obj->GetObject("W3SVC")..gives 'invalid # of param' #my @w3=$obj->{"/W3SVC"}.. gives member not found my @w3=$obj->("W3SVC")||warn Win32::FormatMessage(Win32::OLE->LastErro +r()); foreach $ele(in @w3) { print "$ele->{Name}\n"; if ($ele->{ServerComment} !~/Microsoft IIS Administration|Default +Web Site|DellPAWWAdminTool|Administration Web Site/) {if ( $ele->{Name}=~/\b\d+\b/){push (@listaw3, $ele->{Name})} } } print "@listaw3";
I know this is a basic/stupid question about obj but now I'm in a fix

thanks from not-so-sunny-roma lor*

UPDATE: This is the solution!!!
@w3=$obj->GetObject("","W3SVC/3")||warn Win32::FormatMessage(Win32::OLE->LastError());

Replies are listed 'Best First'.
Re: reuse of Win32::OLE object
by BrowserUk (Patriarch) on Jan 27, 2004 at 11:53 UTC

    This isn't a Perl or Win32::OLE problem. What you need to do is look up the DOM for IIS in order to discover what methods are available from the IIS server object you are getting via my $obj=Win32::OLE->GetObject("IIS://$ip").

    A quick google turned up this, and a quick browse suggests that you may be able to use something like

    $obj->ConnectPath("IIS://LOCALHOST/W3SVC/");

    to achieve your goal. You will need to find and read the DOM docs for your version of IIS.

    Often, doing a Data::Dumper dump of the object handle returned by Win32::OLE will give some clues as to what properties, methods and collections are available at each level of object.

    HTH.


    Examine what is said, not who speaks.
    "Efficiency is intelligent laziness." -David Dunham
    "Think for yourself!" - Abigail
    Timing (and a little luck) are everything!

      thanks BrowserUk !
      I knew it was not a perl q. but I have looked til 25th google page with no encounter ConnectPath ..

      kisses lorenzo*