Hi,
I'm a novice regarding Perl, and need some help converting a VBScript to a
PerlScript.
The following VBScript returns some data from HP OpenView. The
GetChildNodeGroups method returns the number of ChildGroups,
and the [out] parameter NodeGroups returns an array which contains a list
of OV_NodeGroup.
>From the documentation:
sint32 GetChildNodeGroups(
[out] OV_NodeGroup NodeGroups[],
[in, optional] boolean IncludeSubGroups)
Description
Returns a list of node groups (instances of OV_NodeGroup) that are children
of this node group.
Return Value
Number of node groups (children) in the out parameter NodeGroups.
' VBScript Begin
Option Explicit
Dim objWMIService, objOV_NodeGroup, objGetRoot, objChildGroups, arrNodes,
objItem
Set objWMIService = GetObject("winmgmts:root\HewlettPackard\OpenView\data")
Set objOV_NodeGroup = objWMIService.Get("OV_NodeGroup")
Set objGetRoot = objOV_NodeGroup.GetRoot()
objChildGroups = objGetRoot.GetChildNodeGroups(arrNodes, True)
WScript.Echo "Child Group Count: " & objChildGroups & vbCrLF
For Each objItem In arrNodes
WScript.Echo "Name: " & objItem.Name
Next
' VBScript End
The problem is that I can't find out how to get the array (@arrNodes) in
Perl.
# PerlScript Begin
use strict;
use warnings;
use Win32::OLE qw(in with);
use Data::Dumper;
my $objWMIService =
Win32::OLE->GetObject("winmgmts:root/HewlettPackard/OpenView/data") or die
"WMI connection failed.\n";
my $objOV_NodeGroup = $objWMIService->Get("OV_NodeGroup");
my $objGetRoot = $objOV_NodeGroup->GetRoot();
my @arrNodes;
my $objChildGroups = $objGetRoot->GetChildNodeGroups("@arrNodes", "True");
print "Child Group Count: " . $objChildGroups . "\n";
print @arrNodes . "\n";
# PerlScript End
Any help would be appreciated.
/Michael
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs