<div dir="ltr">I went to this example: <a href="http://perlmaven.com/building-a-blog-engine-using-perl-dancer" target="_blank">http://perlmaven.com/building-a-blog-engine-using-perl-dancer</a> and noticed that he put a get sub then followed by a post sub for the same page. Tried this and it worked and the form no longer puts the submited imput into the url which is my objective for using post. I hope that's okay.<br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-10 9:21 GMT-05:00 Richard Reina <span dir="ltr"><<a href="mailto:gatorreina@gmail.com" target="_blank">gatorreina@gmail.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"><div><div><div><div><div>Hi John,<br><br></div>I couple questions about your sample above:<br><br></div>1) in the simple form what should I put for action=?<br><br></div>Here is what I have so far:<br><br><form action="<a href="http://index.tt" target="_blank">index.tt</a>"><br>Query:<br><br><input type="text" name="query" value="Mickey"><br><br><br><br><input type="submit" value="Submit"><br></form> <br><br></div>2) This is what I have for the sub _perform_search<br>sub _perform_search(<br><br> my $fake_search_results = 'Comcast loves net neutrality";<br> return $fake_search_results;<br><br>)<br><br></div>Is this okay?<br><br><br><div><br><br><br><div><br><br></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">2015-08-07 15:15 GMT-05:00 John Stoffel <span dir="ltr"><<a href="mailto:john@stoffel.org" target="_blank">john@stoffel.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
Andrew,<br>
<br>
I think you really need to back up and start from scratch<br>
again. Unfortunately I've got family around and can't spend the time<br>
to help directly, but what I would do is:<br>
<br>
<br>
1. start a new dancer project.<br>
<br>
2. build a new template for the index page with a <form ....><br>
... </form> in it with just a single text entry and a submit button.<br>
Simple stuff. Make sure the text post has a name of 'query'.<br>
<br>
3. You need two routes in your lib/Module.pm file:<br>
<br>
package Module;<br>
use Dancer ':syntax';<br>
use Dancer::Plugin::DBIC;<br>
<br>
our $VERSION = '0.1';<br>
<br>
get '/' => sub {<br>
template 'index', {<br>
title => "The Index",<br>
};<br>
};<br>
<br>
get '/search' => sub {<br>
my $query = params->{query} || "";<br>
my $regexp = $query;<br>
$regexp =~ s/\?|\*/\.\*/g;<br>
my $tobold = $query;<br>
$tobold =~ s/\?|\*//g;<br>
<br>
my @results = ();<br>
my $limit = 50;<br>
if (length $query) {<br>
@results = _perform_search($regexp,$limit);<br>
}<br>
}<br>
<br>
<br>
And of course a subroutine called _perform_search() to do the actual<br>
work.<br>
<br>
<br>
Once you have that working, try using the POST method, and adding in<br>
the:<br>
<br>
post '/search2' => sub {<br>
<br>
}<br>
<br>
routines. Then you *should* be able ot handle it.<br>
<br>
I'd also look more closely at the Dancer Advent calendar stuff as<br>
well. The advantage of GET calls is that you can more easily wrap<br>
them into a div and return results, etc.<br>
<br>
But honestly I'm an old dog also learning new tricks... :-)<br>
<span><font color="#888888"><br>
John<br>
</font></span><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>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div>