Fix build with xapian-core < 1.4.10
[xapian.git] / search-xapian / Xapian / ESet.pm
blob942f97286a47a7b75cff77ea53b0779d8cbfcd93
1 package Search::Xapian::ESet;
3 use 5.006;
4 use strict;
5 use warnings;
6 use Carp;
8 use Tie::Array;
9 require DynaLoader;
11 our @ISA = qw(Tie::Array DynaLoader);
13 # Preloaded methods go here.
15 # In a new thread, copy objects of this class to unblessed, undef values.
16 sub CLONE_SKIP { 1 }
18 use overload '=' => sub { $_[0]->clone() },
19 'fallback' => 1;
21 sub new() {
22 my $class = shift;
23 my $mset;
24 my $invalid_args;
25 if( scalar(@_) == 0 ) {
26 $mset = new1();
27 } elsif( scalar(@_) == 1 and ref( $_[1] ) eq $class ) {
28 $mset = new2(@_);
29 } else {
30 $invalid_args = 1;
32 if( $invalid_args ) {
33 Carp::carp( "USAGE: $class->new(), $class->new(\$eset)" );
34 exit;
36 bless $mset, $class;
37 return $mset;
40 sub items {
41 my $self = shift;
42 my @array;
43 tie( @array, 'Search::Xapian::ESet', $self );
44 return @array;
47 sub TIEARRAY {
48 my $class = shift;
49 my $eset = shift;
50 return bless $eset, $class;