=encoding utf8 =head1 NAME =begin original Mojolicious::Guides::FAQ - Frequently Asked Questions =end original Mojolicious::Guides::FAQ - 頻繁に尋ねられる質問 =head1 OVERVIEW (説明) =begin original This document contains answers for the most frequently asked questions about L. =end original このドキュメントはMojoliciousに関してもっとも頻繁に尋ねられる質問と答えをふくんでいます。 =head1 QUESTIONS (質問) =begin original We hope these answers are to your satisfaction. =end original これらの答えがあなたを満足させるものであることを望んでいます。 =head2 How does Mojolicious compare to other Perl web frameworks? (Mojoliciousは他のPerlのWebフレームワークとどのように比較することができますか) =begin original The short answer is "it doesn't", because we interpret the term "web framework" much more literally than others. With the emergence of the real-time web and new technologies such as WebSockets, we are facing new challenges that go way beyond what commonly used modules like L were designed for. Because of this, L contains a whole new HTTP client/server stack called L, which was heavily inspired by the original LWPng effort and carefully designed with these new requirements in mind. So while some of the higher abstraction layers might look similar to other web frameworks, it is more of a web toolkit and can even be used as the foundation for more advanced web frameworks. =end original 「Webフレームワーク」という言葉は、他のよりもより逐語的に解釈されるので、 短い答えとしては「できない」というものです。 リアルタイムWebやWebSocketのような新しいテクノロジーが出現して、 LWPのように一般的に利用されてきたモジュールが設計されたことを超えた、 新しい挑戦に直面しています。 このために、Mojoliciousは、Mojoと呼ばれる完全に新しいHTTPクライアント/サーバースタックを含んでいいます。これは、もともとはLWPngの努力によって強く鼓舞され、注意深く新しい要求のためにデザインされたものです。 それで、上位の抽象レイヤーのいくつかは、他のWebフレームワークと似ているように見えますが、 実際は完全に新しいカテゴリーとして定義され、未来のより進んだカテゴリーとして、 基礎付けられるのではないかとさえ考えています。 =head2 Why doesn't Mojolicious have any dependencies? (なぜMojoliciousはまったく依存を持たないのですか) =begin original We are optimizing L for user-friendliness and development speed, without compromises. While there are no rules in L that forbid dependencies, we do currently discourage adding non-optional ones in favor of a faster and more painless installation process. And we do in fact already use several optional CPAN modules such as L, L, L, L, L, L and L to provide advanced functionality if possible. =end original 私たちは妥協することなく使いやすさと開発スピードに焦点をあててLを最適化しています。 Lには依存を禁止するルールはありませんが、 すばやい苦労のないインストール処理を好むので、今のところオプショナルなものではないものを 追加する気持ちは起きません。 実際はすでに、高度な機能を提供するために、もしインストールされているのであれば、 L, L,L,L,L、L,Lなどのいくつかのオプショナルなモジュールを利用しています。 =head2 Why reinvent wheels? (なぜ再発明をするのですか) =begin original Because we can make them rounder. Components specifically designed for user-friendliness and development speed are not easy to come by. We are strong believers of the Perl mantra "There is more than one way to do it", and our quest is to develop the best possible solutions for these two criteria. =end original それらを応用可能なものにできるからです。 使いやすさと開発スピードを焦点にあててデザインされたコンポーネントを 手に入れるのは簡単ではありません。 「ひとつ以上のやり方がある」というPerlのマントラを強く信じていますが、 よくデザインされたデフォルトはユーザーの経験によりよい楽しさをもたらすものである ということも信じています。 両方のよい部分がほしいのです。 =head2 What about backwards compatibility? (後方互換性についてはどうですか) =begin original In conformance with L, we will always deprecate a feature for 3 months, before removing or changing it in incompatible ways between major releases. New features can however be marked as experimental to explicitly exclude them from these rules. This gives us the necessary freedom to ensure a healthy future for L. So, as long as you are not using anything marked experimental, untested or undocumented, you can always count on backwards compatibility, everything else would be considered a bug. However, to completely avoid any risk of accidental breakage, we do recommend following current best practices for version pinning with L for production setups. =end original Lとの一致において、 互換性のない方法において、削除や変更がある前に、 最新のひとつのメジャーリリースのなかで、その機能を いつも廃止予定にします。 しかしながら、新しい機能は実験的なものとマークされ、このルールの除外になっています。 これはLの健全な未来を保証するために、必要な自由を与えます。 それで、実験的でない機能、試験されていない機能、ドキュメントされていない機能を使っていない限りは、 後方互換性をいつも期待することができ、そうでないものはバグと考えられます。 ただし、偶発的な破損のリスクを完全に回避するには、 バージョン固定の現在のベストプラクティスに従うことをお勧めします 生産セットアップ用のL。 =head2 Why not split up Mojolicious into many smaller distributions? (なぜMojoliciousは多くの小さなディストリビューションに分割されないのですか) =begin original Because there are no advantages, it drastically increases maintenance costs and installation times without giving us anything in return. It would only make sense if we wanted to pass ownership of a module to a new maintainer, which we already have done in the past. =end original 利点がないからです。 それを行うことは、わたしたちにメリットはないですが、メンテナンスコストを大幅に情報させ、 インストールの時間を増加させます。 モジュールの所有を新しいメンテナに渡せるときだけ意味があるかもしれませんが、 わたしたちはすでに過去にそれを行っています。 =head2 Where can i discuss my patches for Mojolicious? (Mojoliciousのパッチについてどこで議論できますか?) =begin original We'd love to discuss your contributions to L on our official IRC channel C<#mojo> on C (L). =end original 公式IRCでLへの貢献を議論したいと思います CのチャネルC<#mojo>((L))。 =head2 Which versions of Perl are supported by Mojolicious? (どのバージョンのPerlをMojoliciousはサポートしていますか。) =begin original First of all, you need to be aware that according to the L, only the two most recent stable release series of Perl are supported by the community and receive bug fixes, which are currently 5.28.x and 5.26.x. L follows this model and fully supports these two release series. In addition we will also keep the distribution installable (and that means passing all tests) up to a certain legacy version that the core team deems worthy of supporting, but not specifically optimize for it, this is currently 5.10.1. =end original 最初に、Lに関することに気がつく必要があります。 コミュニティは最近のふたつの安定したリリースだけを サポートします。これは現在は、5.28.x and 5.26.xです。 Lはこのモデルにしがたい、これらのふたつのリリースを 完全にサポートします。 加えて、サポートする価値があると考えるある古いバージョンまで、 Mojoliciousのディストリビューションをインストールできるようにしています。 最適化はされません。これは現在は5.10.1です。 =begin original Note that Perl versions 5.10.x and 5.12.x are known to work very poorly with L, and we strongly suggest you do not use them, to avoid stability and security issues. If it wasn't for a very vocal minority within the community we would not support these versions at all. =end original Perlバージョン5.10.xおよび5.12.xは、 L、安定性を避けるためにそれらを使用しないことを強くお勧めします およびセキュリティの問題。コミュニティ内の非常にボーカルな少数派ではない場合 これらのバージョンはまったくサポートしません。 =head2 How well is Windows supported by Mojolicious? (WindowsはMojoliciousでどの程度サポートされていますか?) =begin original Windows is not officially supported by L, even though we try to keep the distribution installable. There may be serious security and/or reliability issues. Some of the more advanced features, such as L and the L web server, will also require the use of the L. =end original ディストリビューションをインストール可能な状態にするよう努力しますが、 Windowsは、Lによって公式にサポートされていません。 。深刻なセキュリティがあるか、または信頼性の問題があります。 次のようなより高度な機能の一部L and the L。 Webサーバーでは、次の使用も必要です。 L =head2 Do I need to clean my environment before testing Mojolicious? (Mojoliciousをテストする前に、環境をクリーンにする必要がありますか) =begin original L uses many environment variables both internally and externally, notably (but not exclusively) those starting with the prefix C and C. The test suite expects a clean environment; testing with a non-standard environment is unsupported and is unlikely to succeed. Therefore when installing or upgrading L and when running its tests, we highly recommend using an environment which does not set these variables. =end original Lは、内部的にも外部的にも、多くの環境変数を使用しています。 これらは CとCというプレフィックスを持ちます。 テストケースは、クリーンな環境を想定しています。 標準ではない環境で試験を行う場合は、サポートしていません。 テストは成功しないかもしれません。 それゆえ、Lをインストールまたはアップグレードすし、 テストを実行するときは、これらの変数を設定しない環境で、 行うことを推奨します。 =head2 Where did my file extension go? (ファイル拡張子は、どこに行ってしまったのですか。) =begin original Standard route placeholders will not match the C<.> character, however L routes automatically take file extensions like C<.html>, remove the leading C<.>, and store the result in the C stash value. This can be useful for URL-based content negotiation, such as automatically rendering different templates based on the file extension. See L for information on customizing format detection, or consider using L to allow matching of the C<.> character. =end original 標準のルートプレースホルダーは、C<.>文字にはマッチしません。 しかしながら、 Lのルートは、C<.html>のようなファイル拡張子を見、 続くC<.>を除去し、Cスタッシュ値の中に、結果を保存します。 これは、ファイル拡張子に基づいた、 自動的に描画される異なるテンプレートのような URLベースのコンテントネゴシエーションで便利です。 フォーマットのカスタマイズの情報は Lを見てください。 また、L を使うことを考慮してください。 これは、C<.>文字のマッチを許可します。 =head2 Can I configure Hypnotoad from the command line? (コマンドラインからHypnotoadを設定できますか?) =begin original No, you can't, L is a bit special in this regard. Because when you initiate a zero downtime software upgrade (hot deployment), you are only really sending a C signal to the already running server, and no other information can be passed along. What you can do instead, is to use a L or L configuration file. =end original いいえ、できません、Lは、この点で少し特別です。 ダウンタイムのないソフトウェアアップグレード(ホット デプロイメント)を始めるときに、既に実行中のサーバーに対して、Cシグナルのみを送信していますので、 他の情報を渡すことはできません。代わりに設定のために LまたはLを使用してください # myapp.conf { hypnotoad => { listen => ['http://*:8080'], workers => 10 } }; =begin original Or if you don't actually need zero downtime software upgrades, just use L instead, which is otherwise almost identical to Hypnotoad. =end original または、ダウンタイムのないソフトウェアアップグレードが実際に必要ない場合は、 Lを代わりに使ってください。それ以外はHypnotoadと同じです。 $ ./myapp.pl prefork -m production -l http://*:8080 -w 10 =head2 What does the error "...certificate verify failed" mean? (エラー「... certificate verify failed」はどういう意味ですか?) =begin original There are many variations of this error, but most of them mean that TLS certificate verification in L failed. This usually happens for two reasons. The most common one is that the peer certificate is simply invalid. If that's the case and you are certain that no MITM attack is being attempted, you can use the attribute L or C environment variable to disable certificate verification. And if that's not the case you might be missing the L module, which is often required by L to be able to verify certificates. =end original このエラーには多くのバリエーションがありますが、それらのほとんどはTLS Lでの証明書の検証に失敗したということです。これは通常 2つの理由で起こります。最も一般的なのは、ピア証明書が単に無効であることです。 その場合、MITM攻撃が試行されていないことが確実な場合、 属性Lまたは証明書の検証を無効にする環境変数Cを使用できます。それ以外に、Lモジュールが欠落している場合があります。これは多くの場合、Lによって、証明書を検証することが必要とされます。 =head2 What does the error "Maximum message size exceeded" mean? ("Maximum message size exceeded."のエラーは何を意味していますか) =begin original To protect your applications from excessively large requests and responses, our HTTP parser has a cap after which it will automatically stop accepting new data, and in most cases force the connection to be closed. The limit is 16MiB for requests, and 2GiB for responses by default. You can use the attributes L and L to change these values. =end original アプリケーションをとても大きなリクエストとレスポンスから 守るために、HTTPパーサーは、自動的に新しいデータを受け付けるのを停止する 上限を設けており、ほとんどの場合接続を切断します。 デフォルトの制限は、リクエストは16MiB、レスポンスは2GiBです。これらの値を変更するためにL と L 属性が使えます。 =head2 What does the error "Maximum start-line size exceeded" mean? ("Maximum start-line size exceeded."のエラーは何を意味していますか) =begin original This is a very similar protection mechanism to the one described in the previous answer, but a little more specific. It limits the maximum length of the start-line for HTTP requests and responses. The limit is 8KiB by default, you can use the attribute L or C environment variable to change this value. =end original これは、リクエスト行、ステータス行、ヘッダーなどの、HTTPメッセージのC<\r\n>で終わる部分の最大の長さの制限です。 この制限はデフォルトで8KiBですが、L属性かC環境変数を使って、この値を変更することができます。 =head2 What does the error "Maximum header size exceeded" mean? ("Maximum header size exceeded"のエラーは何を意味していますか?) =begin original Almost the same as the previous answer, but this protection mechanism limits the number and maximum length of HTTP request and response headers. The limits are 100 headers with 8KiB each by default, you can use the attributes L and L or the C and C environment variables to change these values. =end original これは前の答えで説明されたものとほぼ同じですが、 HTTPリクエストとHTTPレスポンスのヘッダーの最大の長さの制限です。 制限は、デフォルトで、8KiB で100のヘッダです。 LとL あるはC、C環境変数で、 変更することができます。 =head2 What does the error "Maximum buffer size exceeded" mean? ("Maximum buffer size exceeded"のエラーは何を意味していますか) =begin original This protection mechanism limits how much content the HTTP parser is allowed to buffer when parsing chunked, compressed and multipart messages. The limit is around 256KiB by default, you can use the attribute L or C environment variable to change this value. =end original この保護のメカニズムは前のふたつの答えとよく似ています。 HTTPパーサーは、チャンク化、圧縮、マルチパートメッセージを解析しますが、 どれくらいの量のコンテンツをバッファリングするかの制限です。 この制限はデフォルトでは 256KiB ですが、C環境変数 を使って変更することができます。 =head2 What does "Your secret passphrase needs to be changed" mean? ("Your secret passphrase needs to be changed"は何を意味していますか) =begin original L uses secret passphrases for security features such as signed cookies. It defaults to using L, which is not very secure, so we added this log message as a reminder. You can change the passphrase with the attribute L. Since some plugins also depend on it, you should try changing it as early as possible in your application. =end original Lは暗号化クッキーのようなセキュリティの機能のための秘密のパスフレーズを使用します。 デフォルトではアプリケーション名ですが、これはあまり安全とはいえません。 ですので記憶しておいてもらうために、デフォルトのログメッセージ追加しています。 L属性でこのパスフレーズを変更することができます。 $app->secrets(['My very secret passphrase.']); =head2 What does "Nothing has been rendered, expecting delayed response" mean? ("What does "Nothing has been rendered, expecting delayed response"は何を意味していますか) =begin original L has been designed from the ground up for non-blocking I/O and event loops. So when a new request comes in and no response is generated right away, it will assume that this was intentional and return control to the web server, which can then handle other requests while waiting for events such as timers to finally generate a response. =end original LはノンブロッキングI/Oとイベントループの上に構築されるように設計されています。 それで、リクエストが入ってきてすぐにレスポンスが返ってこないときは、 それは意図的なものだと解釈してWebサーバーに応答を返します。 Webサーバーは、タイマーのようなイベントを待っている間に、他のリクエストを処理し、 レスポンスを生成します。 =head2 What does "Inactivity timeout" mean? ("Inactivity timeout."は何を意味していますか。) =begin original To protect your applications from denial-of-service attacks, all connections have an inactivity timeout which limits how long a connection may be inactive before being closed automatically. It defaults to C<20> seconds for the user agent and C<15> seconds for all built-in web servers, and can be changed with the attributes L and L or the C environment variable. In L applications you can also use the helper L to change it on demand for each connection individually. This timeout always applies, so you might have to tweak it for applications that take a long time to process a request. =end original アプリケーションをDoS攻撃から守るために、 すべての接続は非アクティブタイムアウトを持っています。 自動的にドロップする前に、どの程度の時間接続が非アクティブでいることができるかを制限 するものです。 デフォルトでは、ユーザーエージェントのためにC<20>秒が、すべての組み込みサーバーのために C<15>秒が設定されています。そしてこれはL とL 属性またはC 環境変数で変更できます。 L アプリケーションは、それぞれの接続毎にオンデマンドでこれを変更するためにL ヘルパーも使えます。 このタイムアウトはいつでも適用されるので、 リクエストを処理するために、長い時間が必要となるアプリケーションのために、 微調整する必要があるかもしれません。 =head2 What does "Premature connection close" mean? ("Premature connection close."は何を意味していますか) =begin original This error message is often related to the one above, and means that the web server closed the connection before the user agent could receive the whole response or that the user agent got destroyed, which forces all connections to be closed immediately. =end original このエラーメッセージは、上記のひとつに関連して発生します。 ユーザーエージェントが完全なレスポンスを受け取る前に、 Webサーバーが接続を閉じたということを意味しています。 あるいは、ユーザーエージェントが破棄されたということを意味しています。 こうなった場合は、すべてのコネクションが強制的に閉じられます。 # The variable $ua goes out of scope and gets destroyed too early Mojo::IOLoop->timer(5 => sub { my $ua = Mojo::UserAgent->new; $ua->get('https://mojolicious.org' => sub { my ($ua, $tx) = @_; say $tx->result->dom->at('title')->text; }); }); =head2 What does "Worker 31842 has no heartbeat (30 seconds), restarting" mean? ("Worker 31842 has no heartbeat (30 seconds), restarting"は何を意味していますか。) =begin original As long as they are accepting new connections, worker processes of all built-in pre-forking web servers send heartbeat messages to the manager process at regular intervals, to signal that they are still responsive. A blocking operation such as an infinite loop in your application can prevent this, and will force the affected worker to be restarted after a timeout. This timeout defaults to C<30> seconds and can be extended with the attribute L if your application requires it. =end original Hypnotoadワーカープロセスは、マネージャプロセスに、まだ応答可能かどうかを調べるために 定期的な間隔でハートビートメッセージを送ります。 アプリケーションの無限ループのようなブロッキング操作がこれによって防止され、 影響を受けたワーカーがタイムアウトの後にリスタートされます。 Lのデフォルトは30秒で アプリケーションが必要とすれば、増加させることができます。 =head2 What does "Transaction already destroyed" mean? =begin original This error message usually appears after waiting for the results of a non-blocking operation for longer periods of time, because the underlying connection has been closed in the meantime and the value of the attribute L is no longer available. While there might not be a way to prevent the connection from getting closed, you can try to avoid this error message by keeping a reference to the transaction object that is not weakened. =end original 基礎となる接続が、接続時間経過で、閉じられ、Lがもはや利用可能でないため、 このエラーメッセージは通常、ノンブロッキング操作の結果を長く待った後に表示されます。 接続が閉じられないよう回避する方法はないですが、このエラーメッセージをトランザクションのリファレンスを 弱参照しないで、維持することによって避けるようにすることができます。 =begin original # Keep a strong reference to the transaction object my $tx = $c->render_later->tx; $c->ua->get_p('https://mojolicious.org')->then(sub { $c->render(text => 'Visited mojolicious.org'); })->catch(sub { my $err = shift; $tx; $c->reply->exception($err); }); =end original # トランザクションオブジェクトへの強い参照を保持する my $tx = $c->render_later->tx; $c->ua->get_p('https://mojolicious.org')->then(sub { $c->render(text => 'Visited mojolicious.org'); })->catch(sub { my $err = shift; $tx; $c->reply->exception($err); }); =head1 MORE (より学ぶには) =begin original You can continue with L now or take a look at the L, which contains a lot more documentation and examples by many different authors. =end original Lを学び続けてください。またMojolicious wikiを見ることもできます。wikiには多くのユーザーによる多くのドキュメントやサンプルがあります。 =head1 SUPPORT (サポート) =begin original If you have any questions the documentation might not yet answer, don't hesitate to ask on the L or the official IRC channel C<#mojo> on C (L). =end original ドキュメントに答えが見つからなくって質問があるときは、Lか 公式のIRCチャンネルであるCのC<#mojo>(L)でためらわずに質問してください。 =begin meta Translate: 木本裕紀 Translate: 前山将人 Update: SHIRAKATA Kentaro (8.12) =end meta =cut