...
We take the value from the “self” key and look up another result from the server
my $urlSelf = $device->{'self'} ; $selfResults = $browser->get($urlSelf) ; if ( $selfResults ->is_success ) { my $deviceDetails = decode_json( $selfResults->content ) ; if ( defined $deviceDetails -> {'cpu_count'} ) { print $deviceDetails -> {'cpu_count'} , ","; } else { print "(no cpu count), " ; } if (defined $deviceDetails->{'cpu'} ) { # CPU info is an ARRAY - let's just report on the first one # Also, CPU model can contain a comma, so enclose in quotes print '"'; print $deviceDetails->{'cpu'}->[0]->{'cpu_model'}; print '"'; } else { print "(No CPU Model)"; } … and so on … } |
Source code for the completed script
...