stonecolddevin has asked for the wisdom of the Perl Monks concerning the following question:
#!perl -w use strict; use PL; my $obj = PL->new; my $q = $obj->CGI; my $id = $q->param('id'); unless ( $q->param('go') eq 'yup' ) { my $thread = $obj->DBI->Entries->retrieve($id); my @comments = $thread->replies; my @d_body = (); my @d_comment = (); for (@comments) { my %data; $data{author} = $_->author; $data{content} = $_->content; $data{date} = $_->date; push @d_comment, \%data; } # eww....can't figure out a better way for now though for ( $thread ) { my %data2; $data2{author} = $thread->author; $data2{date} = $thread->date; $data2{content} = $thread->content; push @d_body, \%data2; } $obj->Template->file ("tmpl/comments.tmpl"); print $q->header, $obj->Template->format ( { title=>'Viewing thread: ' . $thread->title, body=> \@d_body, comments => \@d_comment } ); } else { if ( $q->param('go') eq 'yup' ) { my $now = $obj->DBI->now; my %form = ( id => '0', author => $q->param('author'), date => $obj->DBI->now, content => $q->param('content'), thread_id => $id ); $obj->DBI->Replies->create (\%form); $obj->DBI->Replies->update; $obj->DBI->Replies->discard_changes; print $q->header, $q->p('Thank you for your reply', $q->a( {-h +ref=>'reply.cgi?id=' . $q->param('id')}, '« Back')); } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Class::DBI error?
by cbrandtbuffalo (Deacon) on Jun 10, 2005 at 11:48 UTC | |
by stonecolddevin (Parson) on Jun 10, 2005 at 11:51 UTC | |
by holli (Abbot) on Jun 10, 2005 at 12:26 UTC | |
by stonecolddevin (Parson) on Jun 10, 2005 at 12:30 UTC | |
by cbrandtbuffalo (Deacon) on Jun 10, 2005 at 12:06 UTC | |
by stonecolddevin (Parson) on Jun 10, 2005 at 12:09 UTC | |
by cbrandtbuffalo (Deacon) on Jun 10, 2005 at 12:14 UTC | |
|