>
>sub getPlayer(){
> return new Player( $_[1] );
>}
>
>
>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?
XS is C code. perl core is C code. So with enough enthusiasm and
poking about you can do ANYTHING in XS.
Naive way is like this
void
getPlayer(
CODE:
{
PUSHMARK(sp); // start a call
XPUSHs(sv_2mortal(newSVpv("Player")); // class name
XPUSHs(ST(1)); // pass arg
PUTBACK;
call_method("new",G_SCALAR);
SPAGAIN;
ST(0) = POPs;
PUTBACK;
XSRETURN(1);
}
>
>For code example see first mail in thread.
>
>Tom
>
>>
>> You should probably call new() from XS. See perldoc perlcall for some info.
>>
>> Cheers,
>>
>> Tels
>>