Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 179681

Error: Can't call method "macAddress" on unblessed reference

$
0
0

Hello.

 

I am learning vSphere perl SDK and trying to udnerdstand how to use various furcntion before I start writting real-life scripts.

 

I want to print the MAC address of all the VMs that are running in my vCetner.

 

Here is the code snippet that I have written:

 

my $vm_views = Vim::find_entity_views ( view_type => "VirtualMachine");

foreach my $vm (@$vm_views)
{
        print "The MAC of " .$vm->name . " is " .  $vm->guest->net->macAddress . "\n";
}

 

And here is hte error i get whne I run above script:

 

Can't call method "macAddress" on unblessed reference at test.pl line 31

 

Could someone tell me where I am going wrong. i know this has something to do wit hte belssed reference but not able to figure that out.

 

This should be an easy one for anyone who has used perl SDK in past.

 

Thanks.


Viewing all articles
Browse latest Browse all 179681

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>