<div dir="ltr"><div><div><div>Hi Andrew,<br><br></div>Let me answer your second question first -- as will bear insight to my answer of the second question. I am using dancer instead of dancer2 because I am too clueless to know any better. I will look to migrate to dancer2 although I am not sure what that entails -- hope my kids and wife remember what I look like. <br><br></div>About how I call it. I am confused here as well. I am merely typing it in the url. I am trying to create a new user login page that will ultimately be a link from my home page. So I will need for it to work as <a href="http://mydomain.com/user">mydomain.com/user</a>. I am afraid I don't know how else to "call" it and confess that I don't completely understand what "call" it means. I just don't want to use GET as it makes the info appears in the url.<br><br></div>Thanks again <br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-07 9:30 GMT-05:00 Andrew Solomon <span dir="ltr"><<a href="mailto:andrew@geekuni.com" target="_blank">andrew@geekuni.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Richard<div><br></div><div>How are you calling it? You can't just call it by putting the url in your browser since the browser will be making a GET request. I'd use curl as described here</div><div><br></div><div><a href="http://superuser.com/questions/149329/what-is-the-curl-command-line-syntax-to-do-a-post-request" target="_blank">http://superuser.com/questions/149329/what-is-the-curl-command-line-syntax-to-do-a-post-request</a><br></div><div><br></div><div>(or in the 'man curl' page if you read it slowly:)</div><div><br></div><div>Next question - why are you using Dancer instead of Dancer2?</div><div><br></div><div>Dancer2 is a redesign to make things more easy/powerful/enjoyable...</div><div><br></div><div>Andrew</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Fri, Aug 7, 2015 at 3:17 PM, Richard Reina <span dir="ltr"><<a href="mailto:gatorreina@gmail.com" target="_blank">gatorreina@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><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="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-2"></a>
<a name="14f0892306b94cef_14f0886823c866b1_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="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-4"></a>Connecting to 0.0.0.0:3000... connected.
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-5"></a>HTTP request sent, awaiting response... 404 Not Found
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-6"></a>2015-08-06 13:52:05 ERROR 404: Not Found.
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-7"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-8"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-9"></a>package MyApp;
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-10"></a>use Dancer ':syntax';
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-11"></a>use Dancer::Plugin::FormValidator;
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-12"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-13"></a>our $VERSION = '0.1';
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-14"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-15"></a>post '/user' => sub {
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-16"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-17"></a> my $input_hash = {
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-18"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-19"></a> FName => param('firstname'),
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-20"></a> LName => param('lastname'),
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-21"></a> Email => param('email'),
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-22"></a> Terms => param('terms'),
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-23"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-24"></a> };
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-25"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-26"></a> my $number_of_defined_values = scalar grep { defined } values %{$input_hash};
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-27"></a> $number_of_defined_values = $number_of_defined_values + 0;
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-28"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-29"></a> if ($number_of_defined_values > 1) {
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-30"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-31"></a> my $error = form_validator_error( 'profile_user', $input_hash );
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-32"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-33"></a> if ( ! $error ) {
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-34"></a> #the user provided complete and validates data it's cool to proceed
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-35"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-36"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-37"></a> } else {
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-38"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-39"></a> my %hash = %$error;
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-40"></a> foreach my $k (keys %hash) {
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-41"></a> return "$k: $hash{$k}\n";
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-42"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-43"></a> }
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-44"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-45"></a> }
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-46"></a> }
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-47"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-48"></a> template 'user';
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-49"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-50"></a>##########################################################
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-51"></a>}; ### end of sub user ###################################
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-52"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-53"></a>true;
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-54"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-55"></a>
<a name="14f0892306b94cef_14f0886823c866b1_14f046122001bfd4_l-56"></a>Thanks in advance for any help.
</pre></div>
<br></div></div>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm" target="_blank">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></blockquote></div><span class="HOEnZb"><font color="#888888"><br><br clear="all"><div><br></div>-- <br><div><div dir="ltr">Andrew Solomon<div><br></div><div>Mentor@Geekuni <a href="http://geekuni.com/" target="_blank">http://geekuni.com/</a></div><div><a href="http://www.linkedin.com/in/asolomon" target="_blank">http://www.linkedin.com/in/asolomon</a><br></div></div></div>
</font></span></div>
<br>_______________________________________________<br>
dancer-users mailing list<br>
<a href="mailto:dancer-users@dancer.pm">dancer-users@dancer.pm</a><br>
<a href="http://lists.preshweb.co.uk/mailman/listinfo/dancer-users" rel="noreferrer" target="_blank">http://lists.preshweb.co.uk/mailman/listinfo/dancer-users</a><br>
<br></blockquote></div><br></div>