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

説明

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::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) }

See "Pragmatic Modules" in perlmodlib and perllexwarn.

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