Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixing error and not requiring submit param - still doesn't work

Signed-off-by: Andy Lester <andy@petdance.com>
  • Loading branch information...
commit 12afa72b3a1ad3f324615e16be369702babbd182 1 parent 3c3de79
sawyer authored committed
Showing with 8 additions and 7 deletions.
  1. +8 −7 formmail.pl
View
15 formmail.pl
@@ -1,8 +1,5 @@
#!/usr/bin/perl
-# TODO:
-# - use Jemplate
-
use strict;
use warnings;
@@ -11,18 +8,20 @@
use Email::Stuff;
sub error {
- my $cgi = shift;
+ my $error_msg = shift;
# we don't really need those since we're updating the page with Jemplate
#my $return_link_url = $cgi->param('return_link_url') || q{};
#my $return_link_title = $cgi->param('return_link_title') || q{};
+ print encode_json { error => $error_msg };
+
+ exit 0;
}
my $cgi = CGI->new();
-# make sure the form was submitted
-$cgi->param('submit') || error($cgi);
+print $cgi->header( -charset => 'UTF-8' );
my $subject = $cgi->param('subject') || q{};
my $name = $cgi->param('realname') || q{};
@@ -33,7 +32,7 @@ sub error {
if ( !$name || !$text ) {
# a name and text are essential
- error($cgi);
+ error('Missing name or text');
}
Email::Stuff->from($from)
@@ -42,3 +41,5 @@ sub error {
->subject($subject)
->send;
+print encode_json { success => 'imminent' };
+
Please sign in to comment.
Something went wrong with that request. Please try again.