O wise and omnipotent monks,
I'm using Class::DBI to retrieve a reply to a thread on a message board I am writing. (The code)
#!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')}, '&laquo Back')); } }

However, it's only returning 0's, so instead of:



Any ideas?
UPDATE: I'd also like to get a better way for retrieving both the original thread and replies for that thread, I had a good thing going with  @comments = $thread->replies, but then the train of thought just kinda died. Any suggestions?
meh.

In reply to Class::DBI error? by stonecolddevin

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.