On 23/02/2017 04:52, Peter Karman wrote:
package MyAnalyzer {
use base qw( Lucy::Analysis::Analyzer );
sub transform { $_[1] }
}
Every Analyzer needs an `equals` method. For simple Analyzers, it can simply
check whether the class of the other object matches:
package MyAnalyzer {
use base qw( Lucy::Analysis::Analyzer );
sub transform { $_[1] }
sub equals { $_[1]->isa(__PACKAGE__) }
}
If the Analyzer uses (inside-out) member variables, you'll also need dump and
load methods. Unfortunately, we don't have good documentation for writing
custom analyzers yet.
*** Error in `perl': corrupted double-linked list: 0x00000000021113a0 ***
This is something that should be fixed. I think that the following happens:
- The exception thrown in the Lucy code causes a refcount leak.
- Because of the leak, the object still exists in Perl's global destruction
phase where the DESTROY method is invoked on the remaining objects in
random order.
- So it can happen that Clownfish object A is destroyed with object B still
referencing it. When B is destroyed, it tries to decrease the refcount of
A, causing memory corruption.
We'll need a custom DESTROY implementation for Perl that ignores objects with
a non-zero refcount or checks whether we're in the global destruction phase.
Nick