-----BEGIN PGP SIGNED MESSAGE-----
Moin,
On Friday 05 March 2004 11:23, Tom Schindl wrote:
Hi,
how can I create an instance of a Perl-class in XS.
I don't know (dont even understand the question properly). However, I could not define a C++ class in XS because apparently "class" is considered some keyword. :/ Does "CLASS" workaround this?
Okay. I'll give it another try.
I have an XS-File with two class definitions named Team and Player. Now if someone is calling Team.getPlayer(player_id) the method creates an instance of Player and returns it.
In pure perl this looks like this:
------------------8<------------------ package Team;
sub new { ## }
sub getPlayer(){ return new Player( $_[1] ); }
## ###################################
package Player;
sub new { ## }
------------------8<------------------
How does one do this if
1. Team and Player are defined in XS 2. Team is defined in XS and player is defined in pure perl-package
Is this possible at all?
For code example see first mail in thread.
Tom
You should probably call new() from XS. See perldoc perlcall for some info.
Cheers,
Tels