标签:call 模板 0.00 cal delay start tin style mojo
1 use Mojolicious::Lite; 2 3 #根目录,Get方法打开 4 #正接显示文本text 5 get ‘/‘ => sub{ 6 my $service = shift; 7 $service->render(text => ‘Hello, world!‘); 8 }; 9 10 get ‘/login‘ => sub{ 11 #pass 12 }; 13 #/login路径用get打开, 如果没找到s"ub函数"(方法) 14 #会用默认的模板打开, 如果默认的模板也没有就会超时404 15 16 app->start; 17 18 # output: 19 # C:\mojo>morbo ./myapp.pl 20 # Server available at http://127.0.0.1:3000 21 # [Sun Feb 26 08:45:56 2017] [debug] GET "/" 22 # [Sun Feb 26 08:45:56 2017] [debug] Routing to a callback 23 # [Sun Feb 26 08:45:56 2017] [debug] 200 OK (0.000942s, 1061.571/s) 24 # [Sun Feb 26 08:46:00 2017] [debug] GET "/login" 25 # [Sun Feb 26 08:46:00 2017] [debug] Routing to a callback 26 # [Sun Feb 26 08:46:00 2017] [debug] Template "login.html.ep" not found 27 # [Sun Feb 26 08:46:00 2017] [debug] Nothing has been rendered, expecting delayed response 28 # [Sun Feb 26 08:46:15 2017] [debug] Inactivity timeout 29 # [Sun Feb 26 08:46:15 2017] [debug] GET "/login" 30 # [Sun Feb 26 08:46:15 2017] [debug] Routing to a callback 31 # [Sun Feb 26 08:46:15 2017] [debug] Template "login.html.ep" not found 32 # [Sun Feb 26 08:46:15 2017] [debug] Nothing has been rendered, expecting delayed response
可以这样运行:
morbo script.pl
标签:call 模板 0.00 cal delay start tin style mojo
原文地址:http://www.cnblogs.com/perl6/p/6443616.html