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: <% content %> Powered by Dancer2 <http://perldancer.org/> <% dancer_version %> wget gives me this: richard@gemini:~/Dancer2/MyApp$ wget -O - http://0:5000/ --2015-08-07 16:53:51-- http://0:5000/ Resolving 0 (0)... 0.0.0.0 Connecting to 0 (0)|0.0.0.0|:5000... connected. HTTP request sent, awaiting response... 200 OK Length: 835 [text/html] Saving to: `STDOUT' 0% [ ] 0 --.-K/s <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-type" content="text/html; charset=<% settings.charset %>" /> <title>MyApp</title> <link rel="stylesheet" href="<% request.uri_base %>/css/style.css" /> <!-- Grab jQuery from a CDN, fall back to local if necessary --> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <script type="text/javascript">/* <![CDATA[ */ !window.jQuery && document.write('<script type="text/javascript" src="<% request.uri_base %>/javascripts/jquery.js"><\/script>') /* ]]> */</script> </head> <body> <% content %> <div id="footer"> Powered by <a href="http://perldancer.org/">Dancer2</a> <% dancer_version %> </div> </body> </html> 100%[========================================================================================>] 835 --.-K/s in 0s 2015-08-07 16:53:51 (5.63 MB/s) - written to stdout [835/835] richard@gemini:~/Dancer2/MyApp$ 2015-08-07 15:47 GMT-05:00 Andrew Solomon <andrew@geekuni.com>:
Dancer2 - definitely.
On Fri, Aug 7, 2015 at 9:25 PM, Richard Reina <gatorreina@gmail.com> wrote:
Okay will start over and try this. I take it I should start over in Dancer2 right?
2015-08-07 15:15 GMT-05:00 John Stoffel <john@stoffel.org>:
Andrew,
I think you really need to back up and start from scratch again. Unfortunately I've got family around and can't spend the time to help directly, but what I would do is:
1. start a new dancer project.
2. build a new template for the index page with a <form ....> ... </form> in it with just a single text entry and a submit button. Simple stuff. Make sure the text post has a name of 'query'.
3. You need two routes in your lib/Module.pm file:
package Module; use Dancer ':syntax'; use Dancer::Plugin::DBIC;
our $VERSION = '0.1';
get '/' => sub { template 'index', { title => "The Index", }; };
get '/search' => sub { my $query = params->{query} || ""; my $regexp = $query; $regexp =~ s/\?|\*/\.\*/g; my $tobold = $query; $tobold =~ s/\?|\*//g;
my @results = (); my $limit = 50; if (length $query) { @results = _perform_search($regexp,$limit); } }
And of course a subroutine called _perform_search() to do the actual work.
Once you have that working, try using the POST method, and adding in the:
post '/search2' => sub {
}
routines. Then you *should* be able ot handle it.
I'd also look more closely at the Dancer Advent calendar stuff as well. The advantage of GET calls is that you can more easily wrap them into a div and return results, etc.
But honestly I'm an old dog also learning new tricks... :-)
John _______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
-- Andrew Solomon
Mentor@Geekuni http://geekuni.com/ http://www.linkedin.com/in/asolomon
_______________________________________________ dancer-users mailing list dancer-users@dancer.pm http://lists.preshweb.co.uk/mailman/listinfo/dancer-users