I am using wmi within Perl and if I get any errors the script will die  I don't 
want to script to die, I want the script to continue.

Here is part of my script and if any of these lines has a problem the script 
dies.  How can I trap the errors and keep the script going?

Thanks
-T

sub GetBIOS
{
        my @arryBIOS;
        my($strComputer) = @_;
        $objWMIService = Win32::OLE->GetObject('winmgmts:\\\\' . $strComputer . 
'\\root\\CIMV2');
        $colItems = $objWMIService->ExecQuery('SELECT * FROM Win32_BIOS', 
undef, 48);            
        foreach my $objItem (in $colItems) {

        print $objItem->Manufacturer . "& " . $objItem->SerialNumber;
        return $objItem->Manufacturer . "& " . $objItem->SerialNumber;
}

}

 


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to