<div dir="ltr"><pre>I am hoping someone can help me understand how to get this to work as a POST instead of GET.<br>When I do sub below as 'get' it works but when I replace 'get' with 'post' I get:
<a name="14f046122001bfd4_l-2"></a>
<a name="14f046122001bfd4_l-3"></a>--2015-08-06 13:52:05-- <a href="http://0.0.0.0:3000/user" target="_blank">http://0.0.0.0:3000/user</a>
<a name="14f046122001bfd4_l-4"></a>Connecting to 0.0.0.0:3000... connected.
<a name="14f046122001bfd4_l-5"></a>HTTP request sent, awaiting response... 404 Not Found
<a name="14f046122001bfd4_l-6"></a>2015-08-06 13:52:05 ERROR 404: Not Found.
<a name="14f046122001bfd4_l-7"></a>
<a name="14f046122001bfd4_l-8"></a>
<a name="14f046122001bfd4_l-9"></a>package MyApp;
<a name="14f046122001bfd4_l-10"></a>use Dancer ':syntax';
<a name="14f046122001bfd4_l-11"></a>use Dancer::Plugin::FormValidator;
<a name="14f046122001bfd4_l-12"></a>
<a name="14f046122001bfd4_l-13"></a>our $VERSION = '0.1';
<a name="14f046122001bfd4_l-14"></a>
<a name="14f046122001bfd4_l-15"></a>post '/user' => sub {
<a name="14f046122001bfd4_l-16"></a>
<a name="14f046122001bfd4_l-17"></a> my $input_hash = {
<a name="14f046122001bfd4_l-18"></a>
<a name="14f046122001bfd4_l-19"></a> FName => param('firstname'),
<a name="14f046122001bfd4_l-20"></a> LName => param('lastname'),
<a name="14f046122001bfd4_l-21"></a> Email => param('email'),
<a name="14f046122001bfd4_l-22"></a> Terms => param('terms'),
<a name="14f046122001bfd4_l-23"></a>
<a name="14f046122001bfd4_l-24"></a> };
<a name="14f046122001bfd4_l-25"></a>
<a name="14f046122001bfd4_l-26"></a> my $number_of_defined_values = scalar grep { defined } values %{$input_hash};
<a name="14f046122001bfd4_l-27"></a> $number_of_defined_values = $number_of_defined_values + 0;
<a name="14f046122001bfd4_l-28"></a>
<a name="14f046122001bfd4_l-29"></a> if ($number_of_defined_values > 1) {
<a name="14f046122001bfd4_l-30"></a>
<a name="14f046122001bfd4_l-31"></a> my $error = form_validator_error( 'profile_user', $input_hash );
<a name="14f046122001bfd4_l-32"></a>
<a name="14f046122001bfd4_l-33"></a> if ( ! $error ) {
<a name="14f046122001bfd4_l-34"></a> #the user provided complete and validates data it's cool to proceed
<a name="14f046122001bfd4_l-35"></a>
<a name="14f046122001bfd4_l-36"></a>
<a name="14f046122001bfd4_l-37"></a> } else {
<a name="14f046122001bfd4_l-38"></a>
<a name="14f046122001bfd4_l-39"></a> my %hash = %$error;
<a name="14f046122001bfd4_l-40"></a> foreach my $k (keys %hash) {
<a name="14f046122001bfd4_l-41"></a> return "$k: $hash{$k}\n";
<a name="14f046122001bfd4_l-42"></a>
<a name="14f046122001bfd4_l-43"></a> }
<a name="14f046122001bfd4_l-44"></a>
<a name="14f046122001bfd4_l-45"></a> }
<a name="14f046122001bfd4_l-46"></a> }
<a name="14f046122001bfd4_l-47"></a>
<a name="14f046122001bfd4_l-48"></a> template 'user';
<a name="14f046122001bfd4_l-49"></a>
<a name="14f046122001bfd4_l-50"></a>##########################################################
<a name="14f046122001bfd4_l-51"></a>}; ### end of sub user ###################################
<a name="14f046122001bfd4_l-52"></a>
<a name="14f046122001bfd4_l-53"></a>true;
<a name="14f046122001bfd4_l-54"></a>
<a name="14f046122001bfd4_l-55"></a>
<a name="14f046122001bfd4_l-56"></a>Thanks in advance for any help.
</pre></div>