=encoding euc-jp =head1 NAME warnings - 選択的な警告を調整する Perl プラグマ =head1 SYNOPSIS use warnings; no warnings; use warnings "all"; no warnings "all"; use warnings::register; if (warnings::enabled()) { warnings::warn("some warning"); } if (warnings::enabled("void")) { warnings::warn("void", "some warning"); } if (warnings::enabled($object)) { warnings::warn($object, "some warning"); } warnings::warnif("some warning"); warnings::warnif("void", "some warning"); warnings::warnif($object, "some warning"); =head1 DESCRIPTION The C pragma is a replacement for the command line flag C<-w>, but the pragma is limited to the enclosing block, while the flag is global. See L for more information. C プラグマは、コマンドラインフラグ C<-w> の置き換えです。 しかし、このフラグはグローバルなのですが、このプラグマは閉じられた ブロックに限定されます。 更なる情報は L を見てください。 If no import list is supplied, all possible warnings are either enabled or disabled. インポートリストを与えない場合は、可能な限り全ての警告を有効にしたり 無効にしたりします。 A number of functions are provided to assist module authors. いくつかの関数は、モジュール作成者の手助けをします。 =over 4 =item use warnings::register Creates a new warnings category with the same name as the package where the call to the pragma is used. プラグマを呼び出したパッケージと同じ名前の新しい 警告カテゴリーを作成します。 =item warnings::enabled() Use the warnings category with the same name as the current package. 現在のパッケージと同じ名前の警告カテゴリーを使います。 Return TRUE if that warnings category is enabled in the calling module. Otherwise returns FALSE. 呼ばれたモジュール内でその警告カテゴリーが有効ならば真(TRUE)を返します。 そうでなければ偽(FALSE)を返します。 =item warnings::enabled($category) Return TRUE if the warnings category, C<$category>, is enabled in the calling module. Otherwise returns FALSE. 呼ばれたモジュール内で警告カテゴリー(C<$category>)が有効ならば真 (TRUE)を返します。 そうでなければ偽(FALSE)を返します。 =item warnings::enabled($object) Use the name of the class for the object reference, C<$object>, as the warnings category. オブジェクトリファレンス(C<$object>)のクラス名を警告カテゴリー として使います。 Return TRUE if that warnings category is enabled in the first scope where the object is used. Otherwise returns FALSE. そのオブジェクトが使われた最初のスコープ内でその警告カテゴリー が有効ならば真(TRUE)を返します。 そうでなければ偽(FALSE)を返します。 =item warnings::warn($message) Print C<$message> to STDERR. STDERR に C<$message> を出力します。 Use the warnings category with the same name as the current package. 現在のパッケージと同じ名前の警告カテゴリーを使います。 If that warnings category has been set to "FATAL" in the calling module then die. Otherwise return. もし、呼ばれたモジュール内でその警告カテゴリーに"FATAL"が設定されていた ならば、終了(die)します。 =item warnings::warn($category, $message) Print C<$message> to STDERR. STDERR に C<$message> を出力します。 If the warnings category, C<$category>, has been set to "FATAL" in the calling module then die. Otherwise return. もし、呼ばれたモジュール内で警告カテゴリー(C<$category>)に"FATAL"が 設定されていたならば、終了(die)します。 =item warnings::warn($object, $message) Print C<$message> to STDERR. STDERR に C<$message> を出力します。 Use the name of the class for the object reference, C<$object>, as the warnings category. オブジェクトリファレンス(C<$object>)のクラス名を警告カテゴリー として使います。 If that warnings category has been set to "FATAL" in the scope where C<$object> is first used then die. Otherwise return. もし、C<$object> が最初に使われたスコープ内でその警告カテゴリー に"FATAL"が設定されていたならば、終了(die)します。 =item warnings::warnif($message) Equivalent to: 次のものに相当します。 if (warnings::enabled()) { warnings::warn($message) } =item warnings::warnif($category, $message) Equivalent to: 次のものに相当します。 if (warnings::enabled($category)) { warnings::warn($category, $message) } =item warnings::warnif($object, $message) Equivalent to: 次のものに相当します。 if (warnings::enabled($object)) { warnings::warn($object, $message) } =back See L and L. L と L を見てください。 =cut