use strict; use warnings; no warnings 'uninitialized'; use CGI qw( :standard ); # use CGI::Carp "fatalsToBrowser"; <-- If you need it use ForumDB; use Template; my $rs = ForumDB->search(); eval { $rs->delete_all() if param('DELETE ALL!'); }; # this delete acts a bit funny sometimes if ( param('add') ) { my $post = $rs->create({ title => ucfirst("title " x rand(15)), time => time(), body => ucfirst("asdf " x rand(100)) }); $post->update(); } elsif ( my $id = param('reply_id') ) { my $parent = $rs->find($id); die unless $parent; my $post = $rs->create({ title => ucfirst("title " x rand(15)), parent => $parent, time => time(), body => ucfirst("asdf " x rand(100)) }); $post->update(); } print redirect( url(), 302 ) if param(); print CGI::header(); my $tt2 = Template->new({ RECURSION => 1, # This is necessary! TRIM => 1, }); $tt2->process(\*DATA, { posts => [ $rs->search() ], cgi => CGI->new(), }) or die $tt2->error(); exit 0; =head1 Threaded forum style posts using a single table- Using L, L, and L. =head2 Included =over 4 =item * Script: forum.cgi Template based demo script. =item * Module: ForumDB.pm Instantiates the DB with SQLite. Provides the DBIx::Class goodies. =back This is a proof of concept. It works though and should show an obvious path for how to put together a more serious version. =head2 Requires Itself (the ForumDB.pm and forum.cgi), SQLite, L, L, L