在 Morbo(和 Hypnotoad)服务器下运行的程序中,调用 会exit()
被静默忽略,并有效地作为回调的返回。END 块通常会触发,但程序本身永远不会退出。
#!/usr/bin/perl
use Modern::Perl;
use Mojolicious::Lite;
END {
say "END block";
}
Mojo::IOLoop->timer(5 => sub {
say "Sleeping...";
sleep 15;
say "Before...";
exit(1);
say "Never seen";
});
app->start;
$ morbo test.pl
Server available at http://127.0.0.1:3000
Sleeping...
Before...
END block
^C