brice_11994
Aug 12, 2008Nimbostratus
Perl LocalLB/VirtualServer - Changing iRules on a VIP
Hey guys,
My end state is to have a script to list the iRules of a VIP, remove iRules from a VIP, and add iRules to a VIP. I am having all kinds of trouble referencing the elements of the array returned with the get_rule function. When I go to reference the returned data I get the following error...
"Bad index while coercing array into hash"
Here is my code
$soapResponse = $VirtServ->get_rule(SOAP::Data->name(virtual_servers => [$sVirt]));
&checkResponse($soapResponse);
@StringRuleList = @{$soapResponse->result};
foreach $StringRule (@StringRuleList)
{
$rule_pri = $StringRule->{"priority"}; <-- This is the line it errors on
$rule_name = $StringRule->{"rule_name"};
print "$rule_name\n$rule_pri\n\n";
}
I have tried to use the Data:Dumper, and I can see the data is being collected, but it will not reference it according to the documentation. Here is the output from Data:Dumper.
$VAR1 = bless( [
bless( {
'priority' => '0',
'rule_name' => 'rule_test'
}, 'LocalLB::VirtualServer::VirtualServerRule' )
], 'LocalLB::VirtualServer::VirtualServerRule[]' );
What am I doing wrong?