From: Justin Guenther Date: Fri, 24 Mar 2006 20:54:55 +0000 (+0000) Subject: documented DBIx::Class::Cursor and DBIx::Class::Storage::DBI::Cursor X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5cf243f6632e706c6f2ddbdeccc29f2a5e6ac362;p=dbsrgits%2FDBIx-Class-Historic.git documented DBIx::Class::Cursor and DBIx::Class::Storage::DBI::Cursor --- diff --git a/lib/DBIx/Class/Cursor.pm b/lib/DBIx/Class/Cursor.pm index df56958..2edf6f6 100644 --- a/lib/DBIx/Class/Cursor.pm +++ b/lib/DBIx/Class/Cursor.pm @@ -1,21 +1,75 @@ -package # hide from PAUSE - DBIx::Class::Cursor; +package DBIx::Class::Cursor; use strict; use warnings; +=head1 NAME + +DBIx::Class::Cursor - Abstract object representing a query cursor on a +resultset. + +=head1 SYNOPSIS + + my $cursor = $schema->resultset('CD')->cursor(); + my $first_cd = $cursor->next; + +=head1 DESCRIPTION + +A Cursor represents a query cursor on a L object. It +allows for traversing the result set with L, retrieving all results with +L and resetting the cursor with L. + +Usually, you would use the cursor methods built into L +to traverse it. See L, +L and L for more +information. + +=head1 METHODS + +=head2 new + +=back + +Virtual method. Returns a new L object. + +=cut + sub new { die "Virtual method!"; } +=head2 next + +=back + +Virtual method. Advances the cursor to the next result. + +=cut + sub next { die "Virtual method!"; } +=head2 reset + +=back + +Virtual method. Resets the cursor to the beginning. + +=cut + sub reset { die "Virtual method!"; } +=head2 all + +=back + +Virtual method. Returns all results in the L. + +=cut + sub all { my ($self) = @_; $self->reset; diff --git a/lib/DBIx/Class/Storage/DBI/Cursor.pm b/lib/DBIx/Class/Storage/DBI/Cursor.pm index 5334589..b339506 100644 --- a/lib/DBIx/Class/Storage/DBI/Cursor.pm +++ b/lib/DBIx/Class/Storage/DBI/Cursor.pm @@ -1,11 +1,41 @@ -package # hide from PAUSE - DBIx::Class::Storage::DBI::Cursor; +package DBIx::Class::Storage::DBI::Cursor; use base qw/DBIx::Class::Cursor/; use strict; use warnings; +=head1 NAME + +DBIx::Class::Storage::DBI::Cursor - Object representing a query cursor on a +resultset. + +=head1 SYNOPSIS + + my $cursor = $schema->resultset('CD')->cursor(); + my $first_cd = $cursor->next; + +=head1 DESCRIPTION + +A Cursor represents a query cursor on a L object. It +allows for traversing the result set with L, retrieving all results with +L and resetting the cursor with L. + +Usually, you would use the cursor methods built into L +to traverse it. See L, +L and L for more +information. + +=head1 METHODS + +=head2 new + +=back + +Returns a new L object. + +=cut + sub new { my ($class, $storage, $args, $attrs) = @_; #use Data::Dumper; warn Dumper(@_); @@ -23,6 +53,14 @@ sub new { return bless ($new, $class); } +=head2 next + +=back + +Advances the cursor to the next result and returns it. + +=cut + sub next { my ($self) = @_; @@ -51,6 +89,14 @@ sub next { return @row; } +=head2 all + +=back + +Returns all results in the L. + +=cut + sub all { my ($self) = @_; @@ -62,6 +108,14 @@ sub all { return @{$sth->fetchall_arrayref}; } +=head2 reset + +=back + +Resets the cursor to the beginning of the L. + +=cut + sub reset { my ($self) = @_;