in reply to Securing a CGI script
Your workaround to get rid of the warning does not appear to do what you intended. Based on some quick tests, it looks like it causes your pattern to be matched against the result of defined ($_mail_from), which is a true/false value and will never match the pattern.
A better solution would be to add a line prior to that match which either returns an error if no from: address is provided ($show_error_message unless defined $_mail_from) or else to assign a default value if it doesn't have one ($_mail_from = 'nobody@nowhere.com' unless $_mail_from, or change line 7 to my $_mail_from = $q->param("mailfrom") || 'nobody@nowhere.com').
|
|---|