3 Bio::DB::GFF::Adaptor::memory::iterator - iterator for Bio::DB::GFF::Adaptor::memory
11 This is an internal module that is used by the Bio::DB::GFF in-memory
12 adaptor to return an iterator across a sequence feature query. The
13 object has a single method, next_feature(), that returns the next
14 feature from the query. The method next_seq() is an alias for
27 Lincoln Stein E<lt>lstein@cshl.orgE<gt>.
29 Copyright (c) 2001 Cold Spring Harbor Laboratory.
31 This library is free software; you can redistribute it and/or modify
32 it under the same terms as Perl itself.
36 package Bio
::DB
::GFF
::Adaptor
::memory
::iterator
;
38 # this module needs to be cleaned up and documented
39 use Bio
::Root
::Version
;
41 *next_seq
= \
&next_feature
;
45 my ($data,$callback) = @_;
47 return bless {data
=> $data,
49 callback
=> $callback,
51 #return bless [$sth,$callback,[]],$class;
56 return shift @
{$self->{cache
}} if @
{$self->{cache
}};
58 my $data = $self->{data
} or return;
59 my $callback = $self->{callback
};
63 my $feature = $data->[$self->{pos}++];
65 $features = $callback->(@
{$feature});
68 $features = $callback->();
75 $self->{cache
} = $features or return;
76 shift @
{$self->{cache
}};