#!/usr/bin/perl -w
use strict;
use warnings;
use POSIX;
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
use DB_File;
my %list;
my $list = "mailinglist.db"; # location of database
tie %list, "DB_File", "$list", O_CREAT|O_RDWR, 0644,
or die "Cannot open file '$list': $!\n";
print header, start_html;
my $name = param('name');
my $email = param('email');
## Get the user information
if (param) {
if ($name) {
if ($email) {
if (exists $list{$email}) {
print " Email address was already found in the database. Action cancelled.";
}
else {
$list{$email} = $name;
print "Thank you, $name. You will be notified of site news and website updates.";
}
}
}
}
foreach (keys %list) {
print "$_ = > $list{$_}
";
}