perlquestion
nleach
<p>
Hi, Still fumbling around trying to retrieve values from, for me, complicated data structures
</p>
<p>
This is what Dumper shows (I’ve both trimmed and anonymoused the data, but hopefully have not screwed the structure)
</p>
<code>
bless( {
'allowedHostnames' => [
'node1',
'node2'
],
'customerName' => 'GarbageA',
'expirationDate' => '2021-08-15T22:59:59.000Z',
'errorMessage' => undef,
'properties' => [
bless( {
'value' => '42000',
'name' => 'maxEngines'
}, 'Property' ),
bless( {
'value' => '',
'name' => 'brokerLeases'
}, 'Property' ),
bless( {
'value' => '',
'name' => 'amazonDevPay'
}, 'Property' ),
bless( {
'value' => GarbageD',
'name' => 'customer_ID'
}, 'Property' ),
bless( {
'value' => ' GarbageE',
'name' => 'LicenseID'
}, 'Property' )
]
}, 'LicenseInfo' )
</code>
<p>
I can successfully get “GarbageA” for customerName, but cannot get 42000 for maxEngines – the error returned is “No such pseudo-hash field maxEngines"
</p>
<p>
This is the code I am using
</p>
<code>
my $soap2 = SOAP::Lite->uri( $_[1] )->proxy( $_[2] )->getLicenseInfo();
my @licenseInfos = $soap2->result ;
for ( my $i = 0 ; $i < @licenseInfos ; $i++ ) {
my $license = $licenseInfos[$i];
print Dumper($license);
my $licensedCustomer = $license->{'customerName'};
print "$licensedCustomer\n";
my $maxEngine = $license->{'properties'}->{'maxEngines'};
print "$maxEngine\n";
}
</code>
Any help much appreciated.
Regards, Nigel
<p>
</p>