hmm... you might wanna reuse existing solutions such as CGI and Net::SMTP. Untested code:
#!/usr/bin/perl use strict; use warnings; use CGI; use Net::SMTP; use vars qw( $cgi %FORM $smtp ); ### get the cgi params $cgi = new CGI(); map { $FORM{$_} = $cgi->param($_) } $cgi->param(); ### and on and on ... unless ( defined($FORM{PARAM1}) && defined($FORM{PARAM2}) ){ #complian } ### smtp stuff $smtp = Net::SMTP->new('mailhost'); $smtp->mail($FORM{FROM_EMAIL}); $smtp->to($FORM{TO_EMAIL}); $smtp->data(); $smtp->datasend("To: $FORM{TO_EMAIL}\n"); $smtp->datasend("Subject: $FORM{SUBJECT}\n"); $smtp->datasend("\n"); my $msg = qq( The following information was submitted from $FORM{NAME} at $FORM{EMAI +L}: Full Name: $FORM{name} Publication Name: $FORM{pubname} Other Authors: $FORM{otherauthors} Other Editors: $FORM{othereditors} Main Publication Title: $FORM{pubtitle} ); $smtp->datasend($msg); $smtp->dataend(); $smtp->quit; + 1;
Update:Thanks VSarkiss
Update:I think the untested speaks for itself. This is an example and nothing more. =]
In reply to Re: checking for null variables
by crouchingpenguin
in thread checking for null variables
by edahm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |