ehorne has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use CGI::Carp qw(fatalsToBrowser); # The following accepts the data from the form and splits it into its +component parts if ($ENV{'REQUEST_METHOD'} eq 'POST') { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } # Then sends the email open (MESSAGE,"| /usr/sbin/sendmail -t"); print MESSAGE "To: design\@erinhorne.com\n"; print MESSAGE "From: " . $FORM{name} . ", reader\n"; print MESSAGE "Reply-to: " . $FORM{email} . "(" . $FORM{name} . ") +\n"; print MESSAGE "Subject: Feedback from $FORM{name} \n\n"; print MESSAGE "$FORM{name} wrote:\n\n"; print MESSAGE "Message: $FORM{message}\n\n"; print MESSAGE "Sent by: $FORM{name} ($FORM{email}).\n"; close (MESSAGE); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl $ENV question
by moritz (Cardinal) on Aug 16, 2009 at 22:21 UTC | |
by ehorne (Initiate) on Aug 17, 2009 at 14:14 UTC | |
|
Re: perl $ENV question
by zwon (Abbot) on Aug 16, 2009 at 22:21 UTC |