When I fill out a form, press submit, and get the results page everything works perfectly. When I want to go back an fill out a new form the page is broken. It seems to be an amalgam of the index page and the results page. The only way I can get it to work is to re-start the Dancer web engine. Here is a copy of the pm that handles the routes:
package NNSP;
use Dancer2;
use Template;
our $VERSION = '0.1';
get '/' => sub {
template 'index';
};
post '/' => sub {
set layout => 'result_format';
template 'result';
};
true;
I think it's better do
template 'result', $hashref, {layout => 'result_format'};
instead of set layout => 'result_format';
or you should do
set layout => 'default_layout';
in hook 'before'
or 'before_template'
as set
sets global parameters.