Fix build with xapian-core < 1.4.10
[xapian.git] / search-xapian / Xapian / MSetIterator.pm
blob4ec880e0e8b69762f64be122059e80d5af381091
1 package Search::Xapian::MSetIterator;
3 use 5.006;
4 use strict;
5 use warnings;
6 use Carp;
8 require DynaLoader;
10 our @ISA = qw(DynaLoader);
12 # Preloaded methods go here.
14 # In a new thread, copy objects of this class to unblessed, undef values.
15 sub CLONE_SKIP { 1 }
17 use overload '++' => sub { $_[0]->inc() },
18 '--' => sub { $_[0]->dec() },
19 '=' => sub { $_[0]->clone() },
20 'eq' => sub { $_[0]->equal($_[1]) },
21 'ne' => sub { $_[0]->nequal($_[1]) },
22 '==' => sub { $_[0]->equal($_[1]) },
23 '!=' => sub { $_[0]->nequal($_[1]) },
24 'fallback' => 1;
26 sub clone() {
27 my $self = shift;
28 my $class = ref( $self );
29 my $copy = new2( $self );
30 bless $copy, $class;
31 return $copy;
34 sub new() {
35 my $class = shift;
36 my $iterator;
37 my $invalid_args;
38 if( scalar(@_) == 0 ) {
39 $iterator = new1();
40 } elsif( scalar(@_) == 1 and ref( $_[1] ) eq $class ) {
41 $iterator = new2(@_);
42 } else {
43 $invalid_args = 1;
45 if( $invalid_args ) {
46 Carp::carp( "USAGE: $class->new(), $class->new(\$iterator)" );
47 exit;
49 bless $iterator, $class;
50 return $iterator;