NAME

DBIx::HTMLView::PostSet - A set posts as in a search result for example

SYNOPSIS

my $post_set=$table->list; # Get a PostSet $post_set->view_html; # view it

$post_set=$table->list; # Get a new one as the old now is used while (defined $post=$self->get_next) { # Process $post... }

$post_set=DBIx::HTMLView::PostSet->new($table) # Create a PostSet in save mode $post_set->add($post);

DESCRIPTION

This a class representing a set of object as for example a result of a search. The object can either be in save mode or in no-save mode. A PostSet object in no-save mode will be able to itterate through the posts once and then they are gone. The posts are never stored, but retrieved from the db when you ask for the next one and then trashed if you don't save them. In save mode this class will star by dowbloading all the posts from the db into memory to allow more advanced manipulations.

$post_set=DBIx:.HTMLView::PostSet->new($tab, $sth, $save)

Creates a new PostSet object for posts from the table $tab (a DBIx::HTMlView::Table object). If $sth is a refrenc it's supposed to be the result of a DBI execute call with a select command. The posts returned from the db will be the ones represented by this set.

If $save is defined to a false value the object will be created in no-save mode, otherview in save mode. Se the DESCRIPTION.

$post_set->rows

Returns the number of rows (posts) in this PostSet as reported by the $sth->rows DBI function.

$post_set->got_post($post)

Returns true if $post has been returned erlier in this set (in which case we won't return it again). Or if we are in save mode returns true if the post is within the set. $post should be a DBIx::HTMLView::Post object.

$post_set->do_got_post

Marks $post (a DBIx::HTMLView::Post object) as a returned post. See $post_set->got_post.

$post_set->tab

Returns the table (a DBIx::HTMLView::Table object) this set of posts belongs to.

$post_set->get_next

Returns the next post (a DBIx::HTMLView::Post object) in the set. The first one will be returned if this method has not been called before.

$post_set->save_mode

Returns true if we are in save mode.

$post_set->add($post)

Adds the post $post (a DBIx::HTMLView::Post object) to the set.

$post_set->posts

Returns an array of DBIx::HTMLView::Post object representing the posts in the set or dies if there is no posts or if we are not in save mode with "No posts!" and "Not in save mode" respectivly.

$post_set->first

Returns the first post of this set, or dies with "No posts!" if there is no posts. If we are in no-save mode it can be called once before any next_post calls are done, after that it will die with "Not in save mode".

$post_set->view_html

Returns a string that can be used to view the entire set of posts in html format.

$post_set->view_text

Returns a string that can be used to view the entire set of posts in text format.