warnings-1.12 > warnings

名前

warnings - Perl pragma to control optional warnings

warnings - 選択的な警告を調整する Perl プラグマ

概要

    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");

説明

The warnings pragma is a replacement for the command line flag -w, but the pragma is limited to the enclosing block, while the flag is global. See perllexwarn for more information.

warnings プラグマは、コマンドラインフラグ -w の置き換えです; しかし、このフラグはグローバルなのですが、このプラグマは閉じられた ブロックに限定されます。 更なる情報は perllexwarn を見てください。

If no import list is supplied, all possible warnings are either enabled or disabled.

インポートリストを与えない場合は、可能な限り全ての警告を有効にしたり 無効にしたりします。

A number of functions are provided to assist module authors.

いくつかの関数は、モジュール作成者の手助けをします。

use warnings::register

Creates a new warnings category with the same name as the package where the call to the pragma is used.

プラグマを呼び出したパッケージと同じ名前の新しい警告カテゴリを作成します。

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)を返します。

warnings::enabled($category)

Return TRUE if the warnings category, $category, is enabled in the calling module. Otherwise returns FALSE.

呼ばれたモジュール内で警告カテゴリ($category)が有効ならば真 (TRUE)を返します。 そうでなければ偽(FALSE)を返します。

warnings::enabled($object)

Use the name of the class for the object reference, $object, as the warnings category.

オブジェクトリファレンス($object)のクラス名を警告カテゴリとして 使います。

Return TRUE if that warnings category is enabled in the first scope where the object is used. Otherwise returns FALSE.

そのオブジェクトが使われた最初のスコープ内でその警告カテゴリが有効ならば 真(TRUE)を返します。 そうでなければ偽(FALSE)を返します。

warnings::fatal_enabled()

Return TRUE if the warnings category with the same name as the current package has been set to FATAL in the calling module. Otherwise returns FALSE.

呼ばれたモジュール内で、現在のパッケージと同じ名前の警告カテゴリが FATAL に 設定されているならば真(TRUE)を返します。 そうでなければ偽(FALSE)を返します。

warnings::fatal_enabled($category)

Return TRUE if the warnings category $category has been set to FATAL in the calling module. Otherwise returns FALSE.

呼ばれたモジュール内で、警告カテゴリ($category)が FATAL に 設定されているならば真(TRUE)を返します。 そうでなければ偽(FALSE)を返します。

warnings::fatal_enabled($object)

Use the name of the class for the object reference, $object, as the warnings category.

オブジェクトリファレンス($object)のクラス名を警告カテゴリとして 使います。

Return TRUE if that warnings category has been set to FATAL in the first scope where the object is used. Otherwise returns FALSE.

そのオブジェクトが使われた最初のスコープ内でその警告カテゴリが FATAL に 設定されているならば真(TRUE)を返します。 そうでなければ偽(FALSE)を返します。

warnings::warn($message)

Print $message to STDERR.

STDERR に $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)します。

warnings::warn($category, $message)

Print $message to STDERR.

STDERR に $message を出力します。

If the warnings category, $category, has been set to "FATAL" in the calling module then die. Otherwise return.

もし、呼ばれたモジュール内で警告カテゴリ($category)に "FATAL" が 設定されていたならば、終了(die)します。

warnings::warn($object, $message)

Print $message to STDERR.

STDERR に $message を出力します。

Use the name of the class for the object reference, $object, as the warnings category.

オブジェクトリファレンス($object)のクラス名を警告カテゴリとして 使います。

If that warnings category has been set to "FATAL" in the scope where $object is first used then die. Otherwise return.

もし、$object が最初に使われたスコープ内でその警告カテゴリに "FATAL" が設定されていたならば、終了(die)します。

warnings::warnif($message)

Equivalent to:

以下のものと等価です:

    if (warnings::enabled())
      { warnings::warn($message) }
warnings::warnif($category, $message)

Equivalent to:

以下のものと等価です:

    if (warnings::enabled($category))
      { warnings::warn($category, $message) }
warnings::warnif($object, $message)

Equivalent to:

以下のものと等価です:

    if (warnings::enabled($object))
      { warnings::warn($object, $message) }
warnings::register_categories(@names)

This registers warning categories for the given names and is primarily for use by the warnings::register pragma, for which see perllexwarn.

これは指定された名前の警告カテゴリを登録します; perllexwarn にあるように、 主に warnings::register プラグマで使われるものです。

"Pragmatic Modules" in perlmodlibperllexwarn を見てください。