From: Aran Deltac Date: Thu, 10 Sep 2009 16:22:57 +0000 (+0000) Subject: Apply version 1.0.1 from CPAN. X-Git-Tag: v1.1.0~9 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Class-Cursor-Cached.git;a=commitdiff_plain;h=e0d8ca03ab4d6dc4efa3c7474e433e7a0bf30f9a Apply version 1.0.1 from CPAN. --- diff --git a/Changes b/Changes new file mode 100644 index 0000000..93b8ddc --- /dev/null +++ b/Changes @@ -0,0 +1,7 @@ +Revision history for DBIx::Class::Cursor::Cached + +1.0.1 7 August 2007 12:37:00 + - Fixed bug in next() as spotted by atsushi kobayashi + +1.0.0 6 August 2007 17:38:00 + - initial release diff --git a/Makefile.PL b/Makefile.PL index dab0fc1..d2ff602 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -3,11 +3,15 @@ use warnings; use inc::Module::Install 0.67; name 'DBIx-Class-Cursor-Cached'; +version '1.0.1'; all_from 'lib/DBIx/Class/Cursor/Cached.pm'; requires 'DBIx::Class' => '0.08004'; requires 'Digest::SHA1'; +build_requires 'Test::More'; +build_requires 'Cache::FileCache'; + auto_install; WriteAll; diff --git a/lib/DBIx/Class/Cursor/Cached.pm b/lib/DBIx/Class/Cursor/Cached.pm index 7fa9d33..5eaf6b0 100644 --- a/lib/DBIx/Class/Cursor/Cached.pm +++ b/lib/DBIx/Class/Cursor/Cached.pm @@ -8,7 +8,7 @@ use Digest::SHA1 (); use vars qw($VERSION); -$VERSION = '0.999001_01'; +$VERSION = '1.000001'; sub new { my $class = shift; @@ -34,7 +34,7 @@ sub new { sub next { my ($self) = @_; - return @{($self->{data} ||= $self->_fill_data)->{$self->{pos}++}||[]}; + return @{($self->{data} ||= $self->_fill_data)->[$self->{pos}++]||[]}; } sub all { diff --git a/t/simple.t b/t/simple.t index c731410..9263e59 100644 --- a/t/simple.t +++ b/t/simple.t @@ -46,14 +46,13 @@ use Cache::FileCache; use DBIx::Class::Cursor::Cached; use Test::More 'no_plan'; +mkdir('t/var'); unlink('t/var/test.db'); my ($dsn, $user, $pass) = ('dbi:SQLite:t/var/test.db'); SchemaClass->connect($dsn,$user,$pass)->init; -require Data::Dumper; - my $expect_data = [ [ 1, 'CD one' ], [ 2, 'CD two' ] ]; { ## start test block @@ -94,7 +93,7 @@ is_deeply($cache->get($rs->cursor->cache_key), $expect_data, ok(!defined($cache->get($rs->cursor->cache_key)), 'cache cleared'); - @cds = $rs->all; # refills cache + @cds = (); while (my $rec = $rs->next) { push(@cds, $rec); } is_deeply([ map { [ $_->id, $_->title ] } @cds ], $expect_data, 'correct data in objects');