perl -Mdiagnostics ./a.pl
か、一時的にスクリプトにuse diagnostics;
を追加するようにスクリプトを実行します。これは、
\1 better written as $1 at ./a.pl line 4 (#1)
(W syntax) Outside of patterns, backreferences live on as variables.
The use of backslashes is grandfathered on the right-hand side of a
substitution, but stylistically it's better to use the variable form
because other Perl programmers will expect it, and it works better if
there are more than 9 backreferences.
のようなものを生成します。(W syntax)
?手紙は次のいずれかであり、あなたが探している警告クラスです。
- (W)警告(オプション)。
- (D)廃止予定(デフォルトで有効)。
- (S)重大な警告(デフォルトで有効)。
- (F)致命的なエラー(トラップ可能)。
- (P)決して見えないはずの内部エラー(トラップ可能)。
- (X)非常に致命的なエラー(非トラップ可能)。
- (A)エイリアンエラーメッセージ(Perlによって生成されない)。
diagnosticsあなたがuse diagnostics;
を使用するのではなく、手動で検索することができperldiagからその情報を取得します。
その他の例:
$ perl -Mdiagnostics -we'print undef'
Use of uninitialized value in print at -e line 1 (#1)
(W uninitialized) An undefined value was used as if it were already
[...]
$ perl -Mdiagnostics -we'no warnings qw(uninitialized); print undef'
$ perl -Mdiagnostics -we'sub foo { } sub foo { }'
Subroutine foo redefined at -e line 1 (#1)
(W redefine) You redefined a subroutine. To suppress this warning, say
[...]
$ perl -Mdiagnostics -we'no warnings qw(redefine); sub foo { } sub foo { }'
$
をええ、 '%のSIG'を使用して、早期(complile-時間)のものに取得する唯一の方法であると思われます。 – zdim