#!/usr/local/bin/perl use strict; use warnings; use CGI; use DBI; my $query = new CGI; my $dbroot = "/var/www/html/lextypedb/db"; my $cssdir = "/lextypedb"; my $cgidir = "/cgi-bin/lextypedb_tools"; my $charset = "utf-8"; my $version = "???"; if(-e "params"){ open(PARAM, "params"); while(){ chomp; (my $para, my $val) = split /=/;#/ if($para eq "dbroot"){ $dbroot = $val; }elsif($para eq "charset"){ $charset = $val; }elsif($para eq "cssdir"){ $cssdir = $val; }elsif($para eq "cgidir"){ $cgidir = $val; }elsif($para eq "version"){ $version = $val; } } open(PARAM, "params"); } #Retrieve all lexical types. my $list_table = 'list_tbl'; my $dbname = $dbroot."/"."lt.db"; my $dbh = DBI->connect("dbi:SQLite:dbname=$dbname", "", "", {AutoCommit => 0}); my $sth = $dbh->prepare( "select * from $list_table" ); $sth->execute; my $total=0; my $out = ""; $out .= ""; while(my @row = $sth->fetchrow_array){ my @word_and_id_tmp = split /@/, $row[2]; my @examples_a = (); foreach (@word_and_id_tmp){ my @word_and_id = split /:/, $_; #/ push(@examples_a, $word_and_id[1]); } my $examples = join(",  ", @examples_a); $out .= ""; $out .= ""; $out .= ""; $out .= ""; $out .= ""; $total++; } $out .= "
Lexical TypeLinguistic NameExample (Lexicon, Corpus)
".$row[0]."".$row[1]."".$examples."  (".$row[3].", ".$row[4].")"."
"; $dbh->commit; # Message ------------------------------------- print $query->header(-type => 'text/html;charset='.$charset), $query->start_html(-title=>'Lexical Type Database: '.$version, -style=>{'src' => $cssdir.'/lextypedb.css'}); print <<"HTML_VIEW";
Word Search: 

Lexical Type Database: $version

$total Lexical Types are found.
$out

HTML_VIEW print $query->end_html; exit; # Error report ----------------------------------- sub error { my ($mes) = @_; print $query->header(-type => 'text/html;charset='.$charset), $query->start_html(-title=>'Creation Error', -style=>{'src' => $cssdir.'/lextypedb.css'}); print <<"HTML_VIEW";

Lexical Type Database: ERROR

$mes


HTML_VIEW print $query->end_html; exit; } __END__