Forum Discussion
Thomas_LE_GENTI
Oct 10, 2008Nimbostratus
ok I found why.
It seems that p1.pl is launching my code. So I have to use only local variables using 'my'.
So it is working.
here is my code :
!/usr/bin/perl
use SOAP::Lite;
use lib ".";
use iControlTypeCast;
die ("Usage: $0 host uid pwd \n") if ($ARGV != 2);
my ($sHost,$sUID,$sPWD) = @ARGV;
my $LocalLBPool = SOAP::Lite
-> uri('urn:iControl:LocalLB/Pool')
-> proxy("https://$sUID:$sPWD\@$sHost/iControl/iControlPortal.cgi");
my $LocalLBPoolMember = SOAP::Lite
-> uri('urn:iControl:LocalLB/PoolMember')
-> proxy("https://$sUID:$sPWD\@$sHost/iControl/iControlPortal.cgi");
my $Soap = $LocalLBPool->get_list();
my $member;
my %SessionStatus;
foreach my $Pool (@{$Soap->result}) {
$Soap = $LocalLBPoolMember->get_session_status (SOAP::Data->name(pool_names => [$Pool]));
foreach $member (@{${$Soap->result}[0]}) {
$SessionStatus{"$member->{'member'}->{'address'}:$member->{'member'}->{'port'}"} = $member->{'session_status'};
}
$Soap = $LocalLBPoolMember->get_priority(SOAP::Data->name(pool_names => [$Pool]));
foreach $member (@{${$Soap->result}[0]}) {
print join (" ",
$Pool,
$member->{'member'}->{'address'},
$member->{'member'}->{'port'},
$SessionStatus{"$member->{'member'}->{'address'}:$member->{'member'}->{'port'}"},
$member->{'priority'}
,"\n"
);
}
}
Edit: it is {$Soap->result } [ 0 ]
and still have an error : "Use of uninitialized value in hash element at /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/iControlTypeCast.pm line 189
any Idea ?
Thks