#!/usr/local/bin/perl -w
# contact.cgi : displays contact data in a nice form.
use CGI;
use Urlify;
$c = new CGI;
$contacts_file = "authors.data";
$HEAD = qq(head);
$TAIL = qq(tail);
undef $/;
open HEAD, $HEAD or die qq(Can't open $HEAD to read: $!\n);
$head =
;
close HEAD;
open TAIL, $TAIL or die qq(Can't open $TAIL to read: $!\n);
$tail = ;
close TAIL;
$/ = qq(\n);
$head =~ s!\.\./!!g; $tail =~ s!\.\./!!g;
$head =~ s/insert_title_here/Contact Information/;
open (CNT, "$contacts_file") or die "Can't open $contacts_file: $!\n";
@display = ("Name", "Telephone", "E-mail");
print $c->header;
$contact = $c->param('contact');
while () {
next if (!/^$contact/);
@info = split /\|/, $_;
last;
}
close (CNT);
#print $c->dump;
print $head;
print $c->h3($c->center("Contact Information")), "\n";
print qq(\n);
foreach (0..$#display) {
$info[$_] =~ s/\r/
\n/g;
print qq(| $display[$_] | ).
Urlify::mailify($info[$_]).qq( |
) if $info[$_];
}
print "
\n";
print $tail;