Home : General : Perl Programming :

General: Perl Programming: Re: [Paul] form script modification: Edit Log

Here is the list of edits for this post
Re: [Paul] form script modification
The script works fine for checking duplication, however I now get an internal server error with the WriteEmail subroutine. I commented out the lines referring to it - and it works - so there is something in there it does not like.




sub CheckDuplicate {
my $found = 0;
open FH, "emails.txt" or die "Cannot read emails: $!";
while (chomp ($_ = <FH>)) {
($Email eq $_) and $found = 1, last;
}
close FH;
if ($found == 1) {&DoDuplicateError;}
# $found ? DoDuplicateError() : WriteEmail();
}


sub DoDuplicateError {
print "Location: $DuplicateErrorPage\n\n";
exit;
}

sub WriteEmail {
# Writes the email to the database.
open (EML, ">> $database") || die "Cannot open $database: $!";
flock (EML, 2) unless $^O eq 'MSWin32';
print (EML, "$in{Email}\n");
close (EML);
return;
}



Last edited by:

shiner: Jun 15, 2002, 8:12 AM

Edit Log: