The code you posted should look like this:
You're right about the problems with references. Don't try to use '&' in the XS prototype -- it definitely does not mean the same as C++. Also remember that in XS a const object is different from non-const, so you need two typemap definitions if you want to handle const objects.void MySettings::set(key, value) string * key string * value
In general, you should use non-const pointers to interface C++ with perl -- eventually perl is going to stuff your object into an int, so it can't be bigger than a pointer. Pointers are conceptually easier to store, and const is going to be casted away anyways. Do your typemaps all use pointers?
If you want to interface perl with methods that take const or reference arguments, the easiest way is to write the XS prototype with non-const pointers and then call the method yourself in the CODE: section. Here's how you'd call MySettings::set(const string &key, const string &value) from XS:
Try perldoc perlxs for more on XS. If you stick to non-const pointers you'll be able to follow most of the examples designed for C.void MySettings::set(key, value) string * key string * value CODE: THIS->set(*key, *value);