#!/usr/bin/perl use strict; use CGI ':standard'; require 'html_stubs'; ############################################################################# #return user category searches from the side menu - e.g. param = 'The State'# ############################################################################# print "Content-type: text/html \n\n "; #output html header header(); #local variables my($id, $main, $discussion, $summary, $title, $subtitle, $year, $speaker, $category, $tlength); #open the main database as a text file and gulp the records into an array open DB,"CompleteDB" || Error(); flock(DB, 1); my @records = ; close(DB); #display category as headline my $rec_length = @records; #search the category fields in the array for the user's $key foreach (@records) { ($id, $main, $discussion, $summary, $title, $subtitle, $year, $speaker, $category, $tlength) = split (/;/); #tidy up output - remove quote marks and trailing blanks $title =~ tr/"/ /; chop $title; $speaker =~ tr/"/ /; $year =~ tr/"/ /; $tlength =~ tr/"/ /; #output print ("

$title"); my $temp = length($summary); if ($temp > 0) { print (" - Part 2 "); } print ("
$speaker $year "); if ($tlength > 0) { print(" - Length: $tlength minutes

"); } } #finish off the html tail(); sub Error { print "in ss Couldn't open completeDB!"; exit; }