解决方法
您可以在liteapp末尾为自定义页面添加名为exception.html.ep或not_found.html.ep的模板.
例如:
use MojolicIoUs::Lite; get '/' => sub { my $self = shift; $self->render(text => "Hello."); }; app->start; __DATA__ @@ not_found.html.ep <!DOCTYPE html> <html> <head><title>Page not found</title></head> <body>Page not found <%= $status %></body> </html>
有关参考,请参阅Mojolicious rendering guide.
The renderer will always try to find exception.$mode.$format.* or not_found.$mode.$format.* before falling back to the built-in default templates.