I am trying to set the refresh rate of a status page using a stash variable So I have the following code in the controller to render the page:
my $refreshrate = 10;
$self->stash( refreshrate => $refreshrate);
$self->render();
in the html template I have:
% layout 'refreshLayout', title => 'A title';
% content_for refresh => begin
% end
<div>....body content .../<div>
and in the layout template I have:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>
<meta charset="UTF-8"/>
<meta http-equiv="refresh" content="<%= refreshrate %>"/>
.....
<title><%= title %></title>
</head>
<body><%= content %></body>
</html>
I always end up with a page rendered with no value in the content attribute of the refresh meta tag.
It looks like the refreshrate replacement does not work.
However both the content and title replacements do work.
So what am I doing wrong here? And while we are here, why in the layout template do we do use <%= content %> (and not $content) While in the template of the regular page we use the more logical <%= $variable %> How does the replacement work in the layout template versus the replacement in the template of the main page?