1 |
joko |
1.1 |
# |
2 |
|
|
# Add error reporting to Win32::OLE |
3 |
|
|
# |
4 |
|
|
|
5 |
|
|
package Win32::OLE::Strict; |
6 |
|
|
use Carp; |
7 |
|
|
use Win32::OLE; |
8 |
|
|
use Win32::OLE::NLS qw(:LOCALE :DATE); |
9 |
|
|
|
10 |
|
|
use strict qw(vars); |
11 |
|
|
our @ISA = qw( Win32::OLE Win32::OLE::NLS ); |
12 |
|
|
use vars qw($AUTOLOAD @ISA); |
13 |
|
|
|
14 |
|
|
sub AUTOLOAD { |
15 |
|
|
my $obj = shift; |
16 |
|
|
$AUTOLOAD =~ s/^.*:://; |
17 |
|
|
my $meth = $AUTOLOAD; |
18 |
|
|
$AUTOLOAD = "SUPER::" . $AUTOLOAD; |
19 |
|
|
my $retval = $obj->$AUTOLOAD(@_); |
20 |
|
|
unless (defined($retval) || $AUTOLOAD eq 'DESTROY') { |
21 |
|
|
my $err = Win32::OLE::LastError(); |
22 |
|
|
croak(sprintf("$meth returned OLE error 0x%08x",$err)) |
23 |
|
|
if $err; |
24 |
|
|
} |
25 |
|
|
return $retval; |
26 |
|
|
} |
27 |
|
|
|
28 |
|
|
1; |