1 package NDWeb::Controller::Quotes;
5 use parent 'Catalyst::Controller';
9 NDWeb::Controller::Quotes - Catalyst Controller
24 sub index :Path :Args(0) {
25 my ( $self, $c ) = @_;
27 $c->assert_user_roles(qw//);
29 my $search = $c->req->param('search');
30 $search =~ s/^\s+|\s+$//g if $search;
32 $c->stash(search => $search);
34 my $query = $dbh->prepare(q{
35 SELECT qid,quote FROM quotes
36 WHERE quote ILIKE '%' || $1 || '%' ORDER BY qid ASC
39 $query->execute($search);
41 $c->stash(quotes => $query->fetchall_arrayref({}));
47 Michael Andreen (harv@ruin.nu)