[Xapian-discuss] Perl bindings and MatchSpy

Andreas Marienborg omega at palle.net
Fri Aug 28 10:01:05 BST 2015

On 28 August 2015 at 12:29:56, Olly Betts (olly at survex.com) wrote:

On Tue, Aug 25, 2015 at 10:45:12AM +0700, Andreas Marienborg wrote:  
> If someone with more XS-exerpience could take a look and provide  
> some feedback, that would be great.  

Looks plausible to me.  

I'd suggest that ~Enquire_perl() just call ref_clear_matchspies(NULL);  
rather than repeating all its code inline.  

Ahh, yes, I forgot to do that before pushing. Fixed it, and updated the pull
request now. Sorry about that.

> I created a pull request[1]. I would like to get the PerlMatchSpy thing  
> working as well, but it might be better to get the wrapping of the   
> ValueCountMatchSpy merged/released regardless of the PerlMatchSpy  
> thing?  

The classes like perlMatchDecider are there to support passing a code  
reference in Perl where the C++ API wants a functor object.  

But Xapian::MatchSpy is rather more than just a function wrapped in a  
class, so I'm not sure it's very useful to be able to pass a code  
reference for it. I guess you could store the information gained in  
a global variable on the perl side.  

Yeah, I was trying to make it possible to have a Perl class extend a
PerlMatchSpy class, and then have that class be called from the XS code on
calls to operator for the C class of it, but I got lost in references this way and 
that somewhere along the way.

Anyway, just being able to use ValueCountMatchSpy from perl is certainly  
useful in itself. I'll look at getting this merged soon.  

Thanks, that would be awesome

- a

More information about the Xapian-discuss mailing list