Forum Discussion

tbledsoe_90582's avatar
tbledsoe_90582
Icon for Nimbostratus rankNimbostratus
Aug 19, 2011

perl error with icontrol

I'm just learning iControl so I'm grabbing published code and trying to reuse it for my own purposes.

 

 

I'm trying to parse LocalLB::PoolMember::get_monitor_association

 

 

So I hacked a similar query which works:

 

 

sub GetPoolStatus()

 

{

 

my $soapResponse = $Pool->get_object_status (

 

SOAP::Data->name(pool_names => [&GetVSPoolList()]) );

 

my @pool_statuses = @{$soapResponse->result};

 

return @pool_statuses;

 

}

 

 

To yield:

 

 

sub getPoolMemberMonitors()

 

{

 

my $soapResponse = $PoolMember->get_monitor_association (

 

SOAP::Data->name(pool_names => [&GetVSPoolList()]) );

 

my @poolmember_statuses = @{$soapResponse->result};

 

return @poolmember_statuses;

 

}

 

 

When I call this object with:

 

 

@pool_monitorsAofA = getPoolMemberMonitors();

 

 

All this XML flows out onto the screen. No other call does this. If I comment out @pool_monitorsAofA, the problem goes away.

 

 

Any ideas what the problem could be?

 

 

Thanks.

 

 

TB

 

 

  • Try putting an & before the method call. In perl, you need to do this when the method returns a parameter

    @pool_monitorsAofA = &getPoolMemberMonitors()