我收到此错误,无法理解为什么会发生这种情况。当我跳转到另一个子程序时会发生这种情况。也许我需要了解 Mojolicious 发生这种情况的原因。
这是我的程序的源代码:
#!/usr/bin/perl
use Mojolicious::Lite;
get '/' => sub { &start_home; };
app->start;
sub start_home {
my $d = shift;
my $something = $d->param('something');
### Do things with $something.... etc.. etc..
&go_somewhere_else; ### Go somewhere else
}
sub go_somewhere_else {
my $c = shift;
$c->render(text => "Hello World!");
### End of program
}
我将一个值传递给渲染器并且有一个值 - 为什么它会说它是未定义的?我的理解是,只有当您跳转到子程序并尝试渲染输出时才会发生这种情况。
我的操作系统是 Windows,我使用的是 Strawberry Perl。