warnings(3p) Perl Programmers Reference Guide warnings(3p)
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");
}
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 informa-
tion.
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.
warnings::enabled($category)
Return TRUE if the warnings category, $category, is
enabled in the calling module. Otherwise returns FALSE.
perl v5.8.8 2005-02-05 1
warnings(3p) Perl Programmers Reference Guide warnings(3p)
warnings::enabled($object)
Use the name of the class for the object reference,
$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.
warnings::warn($message)
Print $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.
warnings::warn($category, $message)
Print $message to STDERR.
If the warnings category, $category, has been set to
"FATAL" in 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 to "FATAL" in the
scope where $object is first used then die. Otherwise
return.
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) }
perl v5.8.8 2005-02-05 2
warnings(3p) Perl Programmers Reference Guide warnings(3p)
See "Pragmatic Modules" in perlmodlib and perllexwarn.
perl v5.8.8 2005-02-05 3
Generated on 2013-04-27 00:20:00 by $MirOS: src/scripts/roff2htm,v 1.77 2013/01/01 20:49:09 tg Exp $
These manual pages and other documentation are copyrighted by their respective writers;
their source is available at our CVSweb,
AnonCVS, and other mirrors. The rest is Copyright © 2002‒2013 The MirOS Project, Germany.
This product includes material
provided by Thorsten Glaser.
This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report – diffs preferred.