html - Perl internal server error when using Email::valid -
i noticed i'm getting internal server error 500 when try use email::valid in cgi script. i'm newbie in this, i'm not able understand problem may be. i'm trying write simple form validator using email::valid validate email addresses, when try put line
use email::valid;
it gives me error. here's complete code:
#!c:\xampp\perl\bin\perl.exe use email::valid; use cgi; $query = new cgi; print $query->header ( ); $nome = $query->param("nome"); $email_address = $query->param("email"); $website = $query->param("website"); $comments = $query->param("messaggio"); $nome = filter ( $nome ); unless( email::valid->address($email_address) ) { $email_address = "invalid email address"; } $website = filter ( $website ); $comments = filter ( $comments ); print "nome: $nome<br>"; print "email: $email_address<br>"; print "sito: $website<br>"; print "$comments<br>"; print <<end_html; <html> <head></head> <body>thanks filling in our form!</body> </html> end_html sub filter { $field = shift; $field =~ s/from://gi; $field =~ s/to://gi; $field =~ s/bcc://gi; $field =~ s/cc://gi; $field =~ s/subject://gi; $field =~ s/content-type://gi; $field =~ s/[\0\n\r\|\!\/\<\>\^\$\%\*\&]+/ /g; return $field; }
when using code without email::valid, works fine!
#!c:\xampp\perl\bin\perl.exe use cgi; $query = new cgi; print $query->header ( ); $nome = $query->param("nome"); $email_address = $query->param("email"); $website = $query->param("website"); $comments = $query->param("messaggio"); $nome = filter ( $nome ); $email_address = filter ( $email_address ); $website = filter ( $website ); $comments = filter ( $comments ); print "nome: $nome<br>"; print "email: $email_address<br>"; print "sito: $website<br>"; print "$comments<br>"; print <<end_html; <html> <head></head> <body>thanks filling in our form!</body> </html> end_html sub filter { $field = shift; $field =~ s/from://gi; $field =~ s/to://gi; $field =~ s/bcc://gi; $field =~ s/cc://gi; $field =~ s/subject://gi; $field =~ s/content-type://gi; $field =~ s/[\0\n\r\|\!\/\<\>\^\$\%\*\&]+/ /g; return $field; }
after searching, found perl server running through xampp didn't install modules successfully. decided switch strawberry running smoothly! problem xampp , module installation.
thanks suggestions , people
Comments
Post a Comment