只能說,再一次被大小寫坑了,作爲菜鳥的我。。。
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');