R
RedAktor
Hi,
I've got one problem with it. I've try to use Error.pm and also set
OLE->Warn param to sub i.e &HandleError. And it catches errors in both ways,
but it doesn't pass OLE error number. In both ways Win32::OLE->LastError()
returns 0. Is there another way to catch the error, get its number and
gently handle it? I'm including ways I've tried to do this:
1st
--------------
Win32::OLE->Option(Warn => &HandleError(Win32::OLE->LastError()));
sub HandleError {
$err = shift;
if ($err == HRESULT(0x80020009)) {
print "Error \n";
exit;
}
}
2nd
-----------------------------
try {
$doc = $docs->Item($di);
$err=Win32::OLE->LastError();
throw Error::Simple $err;
}
catch Error with {
my $E = shift;
print $E;
die;
};
I've got one problem with it. I've try to use Error.pm and also set
OLE->Warn param to sub i.e &HandleError. And it catches errors in both ways,
but it doesn't pass OLE error number. In both ways Win32::OLE->LastError()
returns 0. Is there another way to catch the error, get its number and
gently handle it? I'm including ways I've tried to do this:
1st
--------------
Win32::OLE->Option(Warn => &HandleError(Win32::OLE->LastError()));
sub HandleError {
$err = shift;
if ($err == HRESULT(0x80020009)) {
print "Error \n";
exit;
}
}
2nd
-----------------------------
try {
$doc = $docs->Item($di);
$err=Win32::OLE->LastError();
throw Error::Simple $err;
}
catch Error with {
my $E = shift;
print $E;
die;
};