Hello,
What I want is that in my .pm I use the sub new method to make some initialation.
But in my XS module I have also the new for the C++ class constructor.
Now I found out that if I call in my test.pl MyPackage->new($file) the
method in the XS will be called instead of the new in the .pm file.
How can I avoid this? Or is there a way to put back the initialaition to the .pm module?
Here are some code snippets:
modul.pm:
sub new
{
my $class = shift;
if([EMAIL PROTECTED]) { die "parameter required!\n"; }
my $self = {
FILE=>shift, # file name
isError=>0,
isOOo=>0,
HANDLE=>undef, # HANDLE to file
Error=>undef
};
my ($suffix) = $self->{FILE} =~ m/\.(\w\w\w)$/;
if($suffix eq "sxw" || $suffix eq "sxc" || $suffix eq "odt" || $suffix eq "ods")
{
$self->{isOOo} = 1;
}
bless $self, $class;
return $self;
}
the modul.xs: ... MODULE = Win32::File::Prop PACKAGE = Win32::File::Prop
properties* properties::new(File); char * File
The constructor: properties::properties(char * File) { MultiByteToWideChar(CP_ACP, 0, File, -1, m_File, (sizeof(m_File)/sizeof(WCHAR))); m_hr = S_OK; m_ipStg = NULL; m_hv = (HV* )newHV(); }
In the test.pl I call init the module with my $STR = Module->new($file);
Thank you, Reinhard