in reply to Re^2: Is it a reference issue or what?
in thread Is it a reference issue or what?
I doubt that reblessing a Win32::OLE object will work as you intend it to, because Win32::OLE objects live mainly in C/XS space. I recommend you aggregate the WMI object instead of trying to extend it, and delegate all unknown methods to the WMI object via AUTOLOAD:
sub AUTOLOAD { my $self = shift; (my $meth = $AUTOLOAD) =~ s/.*::/; # Now call the method on the WMI object $self->{wmi}->$meth(@_); }
The above method could be refined further to play with the stack so that all error messages point to the real caller instead of the reflection method, but for a first stab, this approach is OK.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Is it a reference issue or what?
by OzVegan (Acolyte) on Jan 28, 2010 at 19:23 UTC |