The Win32::OLE extension supplies a method to query any error that the preceding action on a COM object might have produced. Every interaction with a COM object (a call into a method or a query or setting of a property) will set the error state, even if no error was generated. Therefore, you must always query the error state before any other interaction with any COM object.
The error state is obtained with a call into the LastError() method:
The LastError() method will return a value based on context. If the method is called in a numeric context, the returned value is the reported error number. If the method is called in a string context, the return value is the error text message.
This method always returns ...