in reply to mod_perl advice required
I know this is a big hint for me but I use 'strict' I get an error, I'm not sure how to assign the $filename and @rows to an explicit package name???#!/usr/bin/perl -W use CGI qw(param); use CGI::Carp qw(fatalsToBrowser); use DBIx::FullTextSearch; use DBIx::FullTextSearch::StopList; use DBI; use HTML::Template; use HTML::Template::Expr; my $dbh = DBI->connect('dbi:mysql:search','??????','??????') or die("C +ould not connect to database"); my $cbh = DBI->connect('dbi:mysql:cobra3','??????','??????') or die("C +ould not connect to database"); my $search = param("search_string"); my $fts = DBIx::FullTextSearch->open($dbh, '??????'); my @files = $fts->search($search); if (@files) { foreach $filename(@files){ $filename = substr($filename,0,-4); my $sth = $cbh->prepare("SELECT id, title, summary FROM resourc +e WHERE id =?"); $sth->execute($filename); while (my $ref = $sth->fetchrow_hashref()){ my $title = $ref->{title}; my $id = $ref->{id}; push @rows, { ID => $id, TITLE => $title }; } } } my $template = HTML::Template->new(filename => 'ee_search.tmpl'); $template->param(SEARCH_STRING => $search); $template->param(ROWS => \@rows); print "Content-type: text/html\n\n"; print $template->output;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: mod_perl advice required
by DrManhattan (Chaplain) on Feb 25, 2003 at 15:39 UTC | |
by shirkdog_perl (Beadle) on Feb 25, 2003 at 16:34 UTC | |
|
Re: Re: mod_perl advice required
by OM_Zen (Scribe) on Feb 25, 2003 at 16:08 UTC | |
by premchai21 (Curate) on Feb 25, 2003 at 20:22 UTC |