[KinoSearch] Bug in binding of fetch_sim (Re: Fwd: CPAN Upload: S/SP/SPROUT/KSx-Highlight-Summarizer-0.05.tar.gz)

webmasters at ctosonline.org webmasters at ctosonline.org
Mon May 11 09:56:37 PDT 2009


On May 10, 2009, at 3:17 PM, Marvin Humphrey wrote:

> BTW, I see the docs specify List::Util as a prerequisite.  However, KS
> requires Perl 5.8.3 as a minimum version, and List::Util became core  
> in 5.7.3:
>
> ... so you can zap that.

You’re not going to consider backporting it? :-)

I have just found another binding bug. I encountered this with  
fetch_sim, but it probably applies elsewhere, too. When a scalar is  
passed to XS, the tied hash magic is not being triggered:

#!/usr/bin/perl -w

require KinoSearch::Schema;
require KinoSearch::FieldType::StringType;

my $schema = new KinoSearch::Schema;
$schema->spec_field(
  name => 'content',
  type => new KinoSearch::FieldType::StringType
);

sub t'TIEHASH { bless [] }
sub t'FETCH { 'content' }
tie %t, t;
warn $schema->fetch_sim('content');
warn $schema->fetch_sim($t{field});
__END__

The first warning produces  
KinoSearch::Search::Similarity=SCALAR(0x801a10) or some such. The  
second produces KinoSearch::Schema=SCALAR(0x800c9c), which is what  
fetch_sim returns when called with undef. (Why does it do that, by the  
way?)

I came across something similar when trying to hack someone else’s C  
code some time ago (one of the few times I’ve programmed in C—I can  
count the occasions on one hand), but that was only for writing to  
tied hashes, not reading from them. So I’m not sure what’s happening.


Father Chrysostomos




More information about the kinosearch mailing list