From: Peter Rabbitson Date: Fri, 14 Sep 2012 05:39:06 +0000 (+0200) Subject: Properly signify internal cursor methods, trash their accessors as well X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=dfa92e5eafa5996b04009a8be7180343abd63675;p=dbsrgits%2FDBIx-Class-Historic.git Properly signify internal cursor methods, trash their accessors as well (the accessors were not used throughout anyway) --- diff --git a/lib/DBIx/Class/Storage/DBI/Cursor.pm b/lib/DBIx/Class/Storage/DBI/Cursor.pm index e4f7d39..a71036e 100644 --- a/lib/DBIx/Class/Storage/DBI/Cursor.pm +++ b/lib/DBIx/Class/Storage/DBI/Cursor.pm @@ -9,7 +9,7 @@ use Try::Tiny; use namespace::clean; __PACKAGE__->mk_group_accessors('simple' => - qw/sth storage args pos attrs _dbh_gen/ + qw/sth storage args attrs/ ); =head1 NAME @@ -53,9 +53,10 @@ sub new { my $new = { storage => $storage, args => $args, - pos => 0, attrs => $attrs, _dbh_gen => $storage->{_dbh_gen}, + _pos => 0, + _done => 0, }; return bless ($new, $class); @@ -83,13 +84,15 @@ sub _dbh_next { if ( $self->{attrs}{software_limit} && $self->{attrs}{rows} - && $self->{pos} >= $self->{attrs}{rows} + && $self->{_pos} >= $self->{attrs}{rows} ) { $self->sth->finish if $self->sth->{Active}; $self->sth(undef); - $self->{done} = 1; + $self->{_done} = 1; } - return if $self->{done}; + + return if $self->{_done}; + unless ($self->sth) { $self->sth(($storage->_select(@{$self->{args}}))[1]); if ($self->{attrs}{software_limit}) { @@ -100,10 +103,10 @@ sub _dbh_next { } my @row = $self->sth->fetchrow_array; if (@row) { - $self->{pos}++; + $self->{_pos}++; } else { $self->sth(undef); - $self->{done} = 1; + $self->{_done} = 1; } return @row; } @@ -168,8 +171,8 @@ sub _soft_reset { my ($self) = @_; $self->sth(undef); - delete $self->{done}; - $self->{pos} = 0; + $self->{_done} = 0; + $self->{_pos} = 0; } sub _check_dbh_gen {