I am trying to understand how to use an instance variable in Perl OO - more specifically, in combination with external resources. Let me explain:
We have a DLL that provides some functionality that I would like to open through the Perl API. I am using Win32 :: OLE to access this dll. Therefore, my constructor is simple:
package MY_CLASS;
use Win32::OLE;
sub new
{
my ($class) = @_;
my $my_dll = Win32::OLE->new("MY_DLL.Control");
my $self = {
MY_DLL => \$my_dll,
};
bless $self, $class or die "Can't bless $!";
return $self;
}
sub DESTROY
{
my ($self) = shift;
undef $sef->{MY_DLL};
}
As you can see, I assign the instance variable MY_DLL a link to $my_dll. I have a couple of questions:
1) How do I call an instance variable since it points to a link. Thus, in other words, how can I call the methods for the dll created in this way as follows:
my $dll_class = new MY_CLASS;
$dll_class->{MY_DLL}->launch();
, start() - , DLL. {MY_DLL} , Perl , . ?
2) undef DESTROY? Perl, undef ?