只能说,再一次被大小写坑了,作为菜鸟的我。。。
warming:如果系统提示XXX not found , 多次查阅无果,请尝试把首字母改为大写。。。
问题:controller类型文件太多,需要归类。。。
直接上好了。。。
│ ├─MyApp │ │ │ Test.pm │ │ │ │ │ ├─Controller │ │ │ Example.pm │ │ │ Page.pm │ │ │ Postpage.pm │ │ │ │ │ └─Test │ │ Aaa.pm │ │
上面是目录布局
Test.pm
package MyApp::Test; use Mojo::Base ‘Mojolicious::Controller‘; 1;
Aaa.pm
package MyApp::Test::Aaa; use Mojo::Base ‘Mojolicious::Controller‘; # This action will render a template sub tta { my $self = shift; $self->stash(msg => ‘hello world!‘); # Render template "Test/Aaa/tta.html.ep" with message $self->render(); } 1;
templates\test\aaa\tta.html.ep
% layout ‘default‘; % title ‘Welcome‘; <h2><%= $msg %></h2>
最后还有一个 route
$r->get(‘/aa‘)->to(‘Test::Aaa#tta‘);
本文出自 “RZL_01的博客” 博客,请务必保留此出处http://rzl01.blog.51cto.com/3004337/1733957
perl---window下Mojolicious框架controller布局
原文:http://rzl01.blog.51cto.com/3004337/1733957