2

自分でmojolicious-liteアプリを作成しました(「アプリの作成」コマンドを使用する代わりに、必要なファイルを手動で作成しました)。ここのチュートリアルに従っています: https://www.perl.com/article/193/2015/9/18/How-to-send-verification-emails-using-Mojolicious/

アプリでコマンド ライン コマンドを使用しようとすると、エラーが発生します。具体的には、チュートリアルから実行しようとしています:

./hello.pl minion job

しかし、より一般的には、コマンドが機能していないように見えることにも気付きました。

./hello.pl help
./hello.pl routes

エラーは、私の postgres ヘルパーの解析にあるようです? 正確なエラーメッセージは次のとおりです。

./hello.pl help
./hello.pl: line 1: use: command not found
./hello.pl: line 2: use: command not found
./hello.pl: line 3: use: command not found
./hello.pl: line 4: use: command not found
./hello.pl: line 5: use: command not found
./hello.pl: line 6: use: command not found
./hello.pl: line 7: use: command not found
./hello.pl: line 10: syntax error near unexpected token `('
./hello.pl: line 10: `helper pg => sub { state $pg = Mojo::Pg->new('postgresql://postgres@/test_users') };'

私のアプリは、コマンド ラインからコマンドを呼び出す以外は正常に動作しています。

これが私のアプリの最初の 11 行です。

use Mojolicious::Lite;
use Mojo::ByteStream;
use Mojo::JWT;
use Mojo::Pg;
use Mojolicious::Plugin::Bcrypt;
use Mojolicious::Plugin::Minion;
use Data::Dumper;


helper pg => sub { state $pg = Mojo::Pg->new('postgresql://postgres@/test_users') };
app->pg->migrations->from_data->migrate;
4

0 に答える 0