lib/SQL/Translator/Producer/DBIx/Class/File.pm
Makefile.PL
MANIFEST This list of files
-META.yml
README
t/02pod.t
t/03podcoverage.t.disabled
t/basicrels/19uuid.t
t/basicrels/20unique.t
t/basicrels/21serialize.t
-t/basicrels/22cache.t
t/basicrels/22cascade_copy.t
+t/basicrels/23cache.t
t/cdbi-sweet-t/08pager.t
t/cdbi-t/01-columns.t
t/cdbi-t/02-Film.t
t/helperrels/20unique.t
t/helperrels/21serialize.t
t/helperrels/22cascade_copy.t
+t/helperrels/23cache.t
t/lib/DBICTest.pm
t/lib/DBICTest/BasicRels.pm
t/lib/DBICTest/Extra.pm
t/run/19uuid.tl
t/run/20unique.tl
t/run/21serialize.tl
-t/run/22cache.tl
t/run/22cascade_copy.tl
+t/run/23cache.tl
t/testlib/Actor.pm
t/testlib/ActorAlias.pm
t/testlib/Binary.pm
t/testlib/Order.pm
t/testlib/OtherFilm.pm
t/testlib/PgBase.pm
+META.yml
sub search {
my $self = shift;
- #use Data::Dumper;warn Dumper(@_);
my $rs;
if( @_ ) {
$attrs = { %$attrs, %{ pop(@_) } };
}
- my $where = (@_ ? ((@_ == 1 || ref $_[0] eq "HASH") ? shift : {@_}) : undef());
+ my $where = (@_
+ ? ((@_ == 1 || ref $_[0] eq "HASH")
+ ? shift
+ : ((@_ % 2)
+ ? $self->throw_exception(
+ "Odd number of arguments to search")
+ : {@_}))
+ : undef());
if (defined $where) {
$where = (defined $attrs->{where}
? { '-and' =>
sub next {
my ($self) = @_;
- my $cache = $self->get_cache;
- if( @$cache ) {
+ my $cache;
+ if( @{$cache = $self->{all_cache} || []}) {
$self->{all_cache_position} ||= 0;
my $obj = $cache->[$self->{all_cache_position}];
$self->{all_cache_position}++;
return $obj;
}
+ if ($self->{attrs}{cache}) {
+ $self->{all_cache_position} = 0;
+ return ($self->all)[0];
+ }
my @row = $self->cursor->next;
# warn Dumper(\@row); use Data::Dumper;
return unless (@row);
my @obj = map { $self->_construct_object(@$_); }
$self->cursor->all;
$self->set_cache( \@obj );
- return @{ $self->get_cache };
+ return @obj;
}
return map { $self->_construct_object(@$_); }
$self->cursor->all;