【发布时间】:2013-12-28 16:44:53
【问题描述】:
我在 CGI 代码中确实有 HTML,如下所示
app->start
__DATA__
@@ rout.html.ep
<% if ($errormsgs) { %>
<% for my $e (@$errormsgs){ %>
<%=$e%>
<br>
<% } %>
<a href="<%= url_for('/') %>">Go back to fix the form</a><br>
<% } %>
<% else{ %>
<%=$successmsg %>
<a href="<%= url_for('/') %>">Send another?</a><br>
<% } %>
我的 CGI 代码是:
if (sendmail %mail) {
$ok .= "Congratulation, your mail was sent!";
$self->stash ( successmsg => $ok );
}
else {
push @errors, "Error sending: $Mail::Sendmail::error";
}
}
$self->stash ( errormsgs => \@errors );
$self->render ( 'rout' );
@errors 工作得很好,但successmsg 我明白了:
syntax error at template rout.html.ep from DATA section line 8, near ";
else"
Global symbol "$successmsg" requires explicit package name at template rout.html.ep from DATA section line 9.
syntax error at template rout.html.ep from DATA section line 11, near "} $_M "
syntax error at template rout.html.ep from DATA section line 11, near "} }"
6
<a href="<%= url_for('/') %>">Go back to fix the form</a><br>
7
<% } %>
8
<% else{ %>
9
<%=$successmsg %>
10
<a href="<%= url_for('/') %>">Send another?</a><br>
11
<% } %>
我不知道我做错了什么,有什么想法吗?
【问题讨论】:
标签: html perl cgi mojolicious