class color { public: color(); ~color(); }; MODULE = Mytest PACKAGE = Mytest void color::DESTROY() color * color::new() #### 1. TYPEMAP 2. color * O_OBJECT 3. 4. OUTPUT 5. # The Perl object is blessed into 'CLASS', which should be a 6. # char* having the name of the package for the blessing. 7. O_OBJECT 8. sv_setref_pv( $arg, CLASS, (void*)$var ); 9. 10. INPUT 11. O_OBJECT 12. if( sv_isobject($arg) && (SvTYPE(SvRV($arg)) == SVt_PVMG) ) 13. $var = ($type)SvIV((SV*)SvRV( $arg )); 14. else{ 15. warn( \"${Package}::$func_name() -- $var is not a blessed SV reference\" ); 16. XSRETURN_UNDEF; 17. } #### my $x = new color();