<div dir="ltr">Okay started over with Dancer2 -a MyApp and before making any of the recomended modicifcations tested out the app out of the box with richard@gemini:~/Dancer2/MyApp$ plackup -r bin/app.psgi and get this in the browser:<br><br><% content %>
<div id="footer">
Powered by <a href="http://perldancer.org/">Dancer2</a> <% dancer_version %><br><br></div>wget gives me this:<br><br>richard@gemini:~/Dancer2/MyApp$ wget -O - <a href="http://0:5000/">http://0:5000/</a><br>--2015-08-07 16:53:51-- <a href="http://0:5000/">http://0:5000/</a><br>Resolving 0 (0)... 0.0.0.0<br>Connecting to 0 (0)|0.0.0.0|:5000... connected.<br>HTTP request sent, awaiting response... 200 OK<br>Length: 835 [text/html]<br>Saving to: `STDOUT'<br><br> 0% [ ] 0 --.-K/s <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"<br> "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>"><br><html xmlns="<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>"><br><head><br><meta http-equiv="Content-type" content="text/html; charset=<% settings.charset %>" /><br><title>MyApp</title><br><link rel="stylesheet" href="<% request.uri_base %>/css/style.css" /><br><br><!-- Grab jQuery from a CDN, fall back to local if necessary --><br><script src="//<a href="http://code.jquery.com/jquery-1.11.1.min.js">code.jquery.com/jquery-1.11.1.min.js</a>"></script><br><script type="text/javascript">/* <![CDATA[ */<br> !window.jQuery && document.write('<script type="text/javascript" src="<% request.uri_base %>/javascripts/jquery.js"><\/script>')<br>/* ]]> */</script><br><br></head><br><body><br><% content %><br><div id="footer"><br>Powered by <a href="<a href="http://perldancer.org/">http://perldancer.org/</a>">Dancer2</a> <% dancer_version %><br></div><br></body><br></html><br>100%[========================================================================================>] 835 --.-K/s in 0s <br><br>2015-08-07 16:53:51 (5.63 MB/s) - written to stdout [835/835]<br><br>richard@gemini:~/Dancer2/MyApp$ <br><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">2015-08-07 15:47 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">Dancer2 - definitely. </div><div class="gmail_extra"><div><div class="h5"><br><div class="gmail_quote">On Fri, Aug 7, 2015 at 9:25 PM, Richard Reina <span dir="ltr"><<a href="mailto:gatorreina@gmail.com" target="_blank">gatorreina@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Okay will start over and try this. I take it I should start over in Dancer2 right?<br></div><div><div><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><br>_______________________________________________<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><br><br clear="all"><div><br></div></div></div><span class="">-- <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>
</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>