http://www.perlmonks.org?node_id=934565


in reply to string plus length typemap hack

The length is a STRLEN, not an unsigned long.

There's also the matter that it's useless to use SvPV without using SvUTF8 too, so you might want to to return that too. Either that or use one of SvPVbyte or SvPVutf8 instead or SvPV.