Hi All, In Perl, $db->set_metadata( "foo", 10 ); Results in, TypeError in method 'WritableDatabase_set_metadata', argument 3 of type 'std::string const &' It looks like this is thrown by the SWIG std::string typemap. Does someone with better SWIG skills than me know how to fix SWIG such that it converts the int to a string rather than croaking? (And besides that it's a very unhelpful error as it has no calling line #) -- All the best, Tim.
On Fri, Mar 11, 2011 at 10:51:41AM +0000, Tim Brody wrote:> In Perl, > > $db->set_metadata( "foo", 10 ); > > Results in, > > > TypeError in method 'WritableDatabase_set_metadata', argument 3 of type > 'std::string const &' > > It looks like this is thrown by the SWIG > std::string typemap. Does someone with better SWIG skills than me know how > to fix SWIG such that it converts the int to a string rather than croaking?That shouldn't be hard to fix - I'll take a look. I guess this works fine in the XS bindings because they just coerce the value to be a string?> (And besides that it's a very unhelpful error as it has no calling line > #)That might be harder to address. Cheers, Olly
On Mon, 2011-03-21 at 14:36 +0000, Olly Betts wrote:> On Fri, Mar 11, 2011 at 10:51:41AM +0000, Tim Brody wrote: > > In Perl, > > > > $db->set_metadata( "foo", 10 ); > > > > Results in, > > > > > > TypeError in method 'WritableDatabase_set_metadata', argument 3 of type > > 'std::string const &' > > > > It looks like this is thrown by the SWIG > > std::string typemap. Does someone with better SWIG skills than me know how > > to fix SWIG such that it converts the int to a string rather than croaking? > > That shouldn't be hard to fix - I'll take a look. > > I guess this works fine in the XS bindings because they just coerce the > value to be a string?I haven't tested this but I expect so.> > (And besides that it's a very unhelpful error as it has no calling line > > #) > > That might be harder to address.It seems odd to me that SWIG's int typecast wouldn't use Perls SvIV nor would does it use "croak". Unless I've missed a typemap in the Xapian code somewhere ... /Tim.