-sub do_edit : Exported {
- my ( $self, $r ) = @_;
- my $h = CGI::Untaint->new( %{ $r->{params} } );
- my $creating = 0;
- my ($obj) = @{ $r->objects || [] };
- if ($obj) {
-
- # We have something to edit
- $obj->update_from_cgi( $h =>
- { required => $r->{config}{ $r->{table} }{required_cols} || [], }
- );
- }
- else {
- $obj =
- $self->create_from_cgi( $h =>
- { required => $r->{config}{ $r->{table} }{required_cols} || [], }
- );
- $creating++;
- }
- if ( my %errors = $obj->cgi_update_errors ) {
-
- # Set it up as it was:
- $r->{template_args}{cgi_params} = $r->{params};
- $r->{template_args}{errors} = \%errors;
- $r->{template} = "edit";
- undef $obj if $creating; # Couldn't create
- }
- else {
- $r->{template} = "view";
- }
- $r->objects( [$obj] );
-}
+The C<list> method fills C<$r-E<gt>objects> with all of the
+objects in the class. The results are paged using a pager.