natxoasenjo
Enthusiast
Enthusiast

You have a typo on declaring $cv_ref, you spell summary wrong.

this works for me:

my $vm_view = Vim::find_entity_views(

    view_type  => 'VirtualMachine',

    filter    => { 'guest.guestState' => 'running' },

    properties => [ 'summary.customValue', 'name', ],

);

for my $vm ( sort { $a->name cmp $b->name } @$vm_view ) {

    my $cv_ref = $vm->{'summary.customValue'};

    next unless defined ( $vm->{'summary.customValue'} ) ;

    print $vm->name . "\n";

    for ( @$cv_ref ) {

        #next unless defined $_->value;

        print "key: ", $_->key, "\tvalue: ", $_->value, "\n";

    }

}

$perl /tmp/kk

vmname

key: 201    value: bladibla

key: 203    value: globalbladibla