[Nolug] Perl question

From: Wimprine, Thomas <twimprine_at_stei.com>
Date: Tue, 3 Feb 2004 11:00:13 -0600
Message-ID: <7A727C65F1901E46BBFE6D9C4C5D82FC34BD3B@lajeffeex02.stei.com>

I'm working on a perl script and I'm getting this error

 

Can't use an undefined value as an ARRAY reference at ./logdisk.pl line 23.

 

Here is the script. Does anyone have any ideas?

 

 

#!/usr/bin/perl -w

 

use VMware::Control;

use VMware::Control::Server;

use VMware::Control::VM;

use strict;

 

my $port = 902;

 

my $server = VMware::Control::Server::new();

 

if (!$server->connect()) {

        my ($errorNumber, $errorString) = $server->get_last_error();

        die "Cannot connect to server: Error $errorNumber: $errorString\n";

}

 

my @list = $server->enumerate();

my $cfg = 0;

foreach $cfg (@list) {

        print "$cfg\n";

        my $vm = VMware::Control::VM::new($server,$cfg);

 

        my @devices = @{$vm->get("Status.devices")};

        my $ndisk = 1;

        my @disks;

        my $disk;

 

        foreach $disk (@devices) {

                if ($disk =~"ethernet" || $disk !~ ":") {

                        next;

                }

 

                my $deviceType = $vm->get("Config.$disk.deviceType");

                if($deviceType eq "atapi-cdrom" || $deviceType eq
"cdrom-image") {

                        next;

                }

 

 

                if (!$vm->add_redo($disk)) {

                        my ($errorNumber, $errorString) =
$vm->get_last_error();

                        die "Cannot add redo log: Error $errorNumber:
$errorString\n";

                }

        }

        $vm->disconnect();

}

 

 

$server->disconnect();

___________________
Nolug mailing list
nolug@nolug.org
Received on 02/03/04

This archive was generated by hypermail 2.2.0 : 12/19/08 EST