1

我正在阅读来自以下网址的 mojo 示例: https ://mojolicious.org/ 下面是代码:

use Mojolicious::Lite -signatures;

# Render template "index.html.ep" from the DATA section
get '/' => sub ($c) {
  $c->render(template => 'index');
};

......

我的问题是如何获得由 perl 编译的这段代码?通常我会将子调用编码为:

get '/' => sub {
      my $c = shift;
      $c->render(template => 'index');
    };

这可以通过草莓 perl 很好地编译。虽然来自 mojo 的示例代码出现错误:

D:\Source\test_code\mojotest>perl mojo3.pl daemon
Illegal character in prototype for ? : $c at mojo3.pl line 4.
Illegal character in prototype for ? : $c at mojo3.pl line 9.
Illegal character in prototype for ? : $c, $msg at mojo3.pl line 10.

谁能告诉我为什么?

4

0 回答 0