From: James E. J. Jr. <mu...@us...> - 2003-08-02 06:16:48
|
Update of /cvsroot/psp/psp/lib/tools/FieldSpace In directory sc8-pr-cvs1:/tmp/cvs-serv27645/psp/lib/tools/FieldSpace Modified Files: Group.pm Log Message: we now use dummy_ok() accessor. make sure n_items() is 0 when undefined. Index: Group.pm =================================================================== RCS file: /cvsroot/psp/psp/lib/tools/FieldSpace/Group.pm,v retrieving revision 1.3 retrieving revision 1.4 diff -u -r1.3 -r1.4 --- Group.pm 1 Nov 2002 22:59:34 -0000 1.3 +++ Group.pm 2 Aug 2003 06:16:46 -0000 1.4 @@ -127,6 +127,7 @@ sub n_items_per_page { shift->gen_value('n_items_per_page', @_) } sub n_pages_at_a_time { shift->gen_value('n_pages_at_a_time', @_) } sub poss_n_items_per_page { shift->gen_value('poss_n_items_per_page', @_) } +sub dummy_ok { shift->gen_value('dummy_ok', @_) } sub gen_int_rule { my ($this,$name,$val) = @_; @@ -221,7 +222,7 @@ # if we have dummy_ok, do not guess any further than the number # of the last object we currently have. - if (!$this->{dummy_ok}) { + if (!$this->dummy_ok()) { # otherwise, compute the next objects until we find the last one. # leave the objects array sparse, but cache the last object. @@ -252,7 +253,7 @@ $this->cursor() - $this->first_item_n() >= $this->n_items_per_page()) { return undef; } - return($this->object() || $this->{dummy_ok}); + return($this->object() || $this->dummy_ok()); } sub object { @@ -318,7 +319,7 @@ $index or $index = $this->cursor(); if (defined $field) { $this->{fields}->{$field_name}->[$index-1] = $field; - $this->n_items($index) if $index > $this->n_items(); + $this->n_items($index) if $index > ($this->n_items()||0); } return unless $this->{fields}->{$field_name}; return $this->{fields}->{$field_name}->[$index-1]; @@ -503,7 +504,7 @@ $new_first_item_n = 1; } # next, validate upper boundary. - if (! $this->{dummy_ok} and $new_first_item_n > $this->n_items()) { + if (! $this->dummy_ok() and $new_first_item_n > $this->n_items()) { $new_first_item_n = $this->first_item_n_from_page_n($this->n_pages()); } # if the $new_first_item is the same as current, it is not new. |