From: Peter Rabbitson Date: Sun, 11 Oct 2009 13:44:18 +0000 (+0000) Subject: More ordered fixes X-Git-Tag: v0.08113~35 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=69cd8a7fcceed892f3bbd6cfba5804776033a85b;p=dbsrgits%2FDBIx-Class.git More ordered fixes --- diff --git a/Changes b/Changes index 3e3fdbd..f39901e 100644 --- a/Changes +++ b/Changes @@ -6,6 +6,7 @@ Revision history for DBIx::Class (RT #50209) - Fixed on_connect_do/call regression when used with a coderef connector (RT #50003) + - A couple of fixes to Ordered to remedy subclassing issues 0.08112 2009-09-21 10:57:00 (UTC) - Remove the recommends from Makefile.PL, DBIx::Class is not diff --git a/lib/DBIx/Class/Ordered.pm b/lib/DBIx/Class/Ordered.pm index 4499d86..5f17790 100644 --- a/lib/DBIx/Class/Ordered.pm +++ b/lib/DBIx/Class/Ordered.pm @@ -682,27 +682,9 @@ You would want to override the methods below if you use sparse if you are working with preexisting non-normalised position data, or if you need to work with materialized path columns. -=head2 _position - - my $num_pos = $item->_position; - -Returns the B of the current object, with the -first object being at position 1, its sibling at position 2 and so on. -By default simply returns the value of L. - -=cut -sub _position { - my $self = shift; - -# #the right way to do this -# return $self->previous_siblings->count + 1; - - return $self->get_column ($self->position_column); -} - =head2 _position_from_value - my $num_pos = $item->_position_of_value ( $pos_value ) + my $num_pos = $item->_position_from_value ( $pos_value ) Returns the B of an object with a B set to C<$pos_value>. By default simply returns C<$pos_value>. @@ -864,6 +846,19 @@ sub _siblings { ); } +=head2 _position + + my $num_pos = $item->_position; + +Returns the B of the current object, with the +first object being at position 1, its sibling at position 2 and so on. + +=cut +sub _position { + my $self = shift; + return $self->_position_from_value ($self->get_column ($self->position_column) ); +} + =head2 _grouping_clause This method returns one or more name=>value pairs for limiting a search