warnings - Perl pragma to control optional warnings |
warnings - Perl pragma to control optional warnings
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"); }
warnif("some warning"); warnif("void", "some warning"); 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.
Return TRUE if that warnings category is enabled in the calling module. Otherwise returns FALSE.
$category
, is enabled in the
calling module.
Otherwise returns FALSE.
$object
, as the
warnings category.
Return TRUE if that warnings category is enabled in the first scope where the object is used. Otherwise returns FALSE.
$message
to STDERR.
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.
$message
to STDERR.
If the warnings category, $category
, has been set to ``FATAL'' in the
calling module then die. Otherwise return.
$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 to ``FATAL'' in the scope where $object
is first used then die. Otherwise return.
if (warnings::enabled()) { warnings::warn($message) }
if (warnings::enabled($category)) { warnings::warn($category, $message) }
if (warnings::enabled($object)) { warnings::warn($object, $message) }
See Pragmatic Modules in the perlmodlib manpage and the perllexwarn manpage.
warnings - Perl pragma to control optional warnings |