Seth Woolley's Man Viewer

warnings(3) - warnings - Perl pragma to control optional warnings - man 3 warnings

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

warnings(3)            Perl Programmers Reference Guide            warnings(3)



NAME
       warnings - Perl pragma to control optional warnings

SYNOPSIS
           use warnings;
           no warnings;

           use warnings "all";
           no warnings "all";

           use warnings::register;
           if(3,n) (warnings::enabled()) {
               warnings::warn("some warning");
           }

           if(3,n) (warnings::enabled("void")) {
               warnings::warn("void", "some warning");
           }

           if(3,n) (warnings::enabled($object)) {
               warnings::warn($object, "some warning");
           }

           warnings::warnif("some warning");
           warnings::warnif("void", "some warning");
           warnings::warnif($object, "some warning");

DESCRIPTION
       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.

       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 pack-
           age.

           Return TRUE if(3,n) that warnings category is enabled in(1,8) the calling
           module.  Otherwise returns FALSE.

       warnings::enabled($category)
           Return TRUE if(3,n) the warnings category, $category, is enabled in(1,8) the
           calling module.  Otherwise returns FALSE.

       warnings::enabled($object)
           Use the name of the class for the object reference, $object, as the
           warnings category.

           Return TRUE if(3,n) that warnings category is enabled in(1,8) the first scope
           where the object is used.  Otherwise returns FALSE.

       warnings::warn($message)
           Print $message to STDERR.

           Use the warnings category with the same name as the current pack-
           age.

           If that warnings category has been set(7,n,1 builtins) to "FATAL" in(1,8) the calling
           module then die. Otherwise return.

       warnings::warn($category, $message)
           Print $message to STDERR.

           If the warnings category, $category, has been set(7,n,1 builtins) to "FATAL" in(1,8) the
           calling module then die. Otherwise return.

       warnings::warn($object, $message)
           Print $message to STDERR.

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

           If that warnings category has been set(7,n,1 builtins) to "FATAL" in(1,8) the scope
           where $object is first used then die. Otherwise return.

       warnings::warnif($message)
           Equivalent to:

               if(3,n) (warnings::enabled())
                 { warnings::warn($message) }

       warnings::warnif($category, $message)
           Equivalent to:

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

       warnings::warnif($object, $message)
           Equivalent to:

               if(3,n) (warnings::enabled($object))
                 { warnings::warn($object, $message) }

       See "Pragmatic Modules" in(1,8) perlmodlib and perllexwarn.



perl v5.8.5                       2001-09-21                       warnings(3)

References for this manual (incoming links)