Thank you for your response. Yes it worked but when I tried to print each value I am just getting hash reference and not the value.
Below is my code in .pm file
I need to produce output like this
'/Common/10.116.38.51', 10.116.38.51:1935, enabled:ENABLED, avail
+ability:GREEN
'/Common/10.116.38.52', 10.116.38.52:1935, enabled:ENABLED, availa
+bility:GREEN
from the this
print Dumper(@status);
$VAR1 = bless( [ bless( { 'address' => '/Common/10.116.38.51', 'port'
+=> '80' }, 'Common::AddressPort' ), bless( { 'address' => '/Common/10
+.116.38.52', 'port' => '80' }, 'Common::AddressPort' ) ], 'Common::Ad
+dressPort[]' ); $VAR2 = bless( [ bless( { 'availability_status' => 'A
+VAILABILITY_STATUS_GREEN', 'status_description' => 'Pool member is av
+ailable', 'enabled_status' => 'ENABLED_STATUS_ENABLED' }, 'LocalLB::O
+bjectStatus' ), bless( { 'availability_status' => 'AVAILABILITY_STATU
+S_GREEN', 'status_description' => 'Pool member is available', 'enable
+d_status' => 'ENABLED_STATUS_ENABLED' }, 'LocalLB::ObjectStatus' ) ],
+ 'LocalLB::ObjectStatus[]' );
My mail .pm files with has the below code
</code>
sub locallb_get_member_v2 {
my $ENABLED_STATUS_MAP = {
"ENABLED_STATUS_NONE" => "NONE",
"ENABLED_STATUS_ENABLED" => "ENABLED",
"ENABLED_STATUS_DISABLED" => "DISABLED",
"ENABLED_STATUS_DISABLED_BY_PARENT" => "DISABLED_BY_PARENT",
};
my $AVAILABILITY_STATUS_MAP = {
'AVAILABILITY_STATUS_NONE' => 'Error scenario',
'AVAILABILITY_STATUS_GREEN' => 'GREEN',
'AVAILABILITY_STATUS_YELLOW' => 'YELLOW',
'AVAILABILITY_STATUS_RED' => 'RED',
'AVAILABILITY_STATUS_BLUE' => 'BLUE',
'AVAILABILITY_STATUS_GRAY' => 'GRAY',
};
push (@status,@memberobjectstatus);
my %members;
foreach my $member (@status){
$members{ $status->{'address'} =
$member->{'port'}};
$members{ $status}->{'enabled'} =
$ENABLED_STATUS_MAP->{ $status->{'enabled_status'} } ;
$members{ $status}->{'availability'} =
$AVAILABILITY_STATUS_MAP->{ $status->{'availability_status'} } ;
return \%members;
}
</code>
In main cgi i have the below code
my $membershref =
$bigip->locallb_get_member_v
+2( $bigip_host,
$pool );
if ( !$membershref ){
printError("Failed to find mem
+bers for $pool");
}
else {
# if ( !$membershref );
print '<UL>';
+ # Pool Members
foreach my $member ( sort keys
+ %{$membershref} ) {
print li(
"'$member', $membershref->{$member}->{'address'}:$membershref->{$membe
+r}->{'port'},
enabled:$membe
+rshref->{$member}->{'enabled'}, availability:$memb
ershref->{$member}->{'availability'}"
);
}
print '</UL>';
But the above code produce below output
'HASH(0xbafd04)', :, enabled:, availability:
|