// This will be used to generate the XS MODULE line %module{Object::WithIntAndString}; // Associate a perl class with a C++ class %name{Object::WithIntAndString} class IntAndString { // can be called in Perl as Object::WithIntAndString->new( ... ); IntAndString(); // Object::WithIntAndString->newIntAndString( ... ); // %name can be used to assign methods a different name in Perl %name{newIntAndString} IntAndString( const char* str, int arg ); // standard DESTROY method ~IntAndString(); // Will be available from Perl given that the types appear in the typemap int GetInt(); const char* GetString (); // SetValue is polymorphic. We want separate methods in Perl %name{SetString} void SetValue( const char* arg = NULL ); %name{SetInt} void SetValue( int arg ); // Supply a C or C block for the XS int Sum( int a, int b ) %code{% RETVAL = a + b; %} %cleanup{% /* do something */ %}; };