No::Worries::Warn man page on Fedora

Man page or keyword search:  
man Server   31170 pages
apropos Keyword Search (all sections)
Output format
Fedora logo
[printable version]

No::Worries::Warn(3)  User Contributed Perl Documentation No::Worries::Warn(3)

NAME
       No::Worries::Warn - warning handling without worries

SYNOPSIS
	 use No::Worries::Warn qw(warnf handler);

	 if (open($fh, "<", $path)) {
	     ... so something in case of success ...
	 } else {
	     warnf("cannot open(%s): %s", $path, $!);
	     ... do something else in case of failure ...
	 }

	 $ ./myprog
	 myprog: cannot open(foo): No such file or directory

	 $ NO_WORRIES=cluck ./myprog
	 myprog: cannot open(foo): No such file or directory at myprog line 16
	     main::test() called at ./myprog line 19

DESCRIPTION
       This module eases warning handling by providing a convenient wrapper
       around warn() with sprintf()-like API. warnf() is to warn() what
       printf() is to print() with, in addition, the trimming of leading and
       trailing spaces.

       It also provides a handler for warn() that prepends a prefix
       ($No::Worries::Warn::Prefix) to all warnings. It also uses the
       NO_WORRIES environment variable to find out if Carp's carp() or cluck()
       should be used instead of warn(). Finally, the wrapper can be told to
       also log warnings to syslog (see $No::Worries::Warn::Syslog).

       This handler can be installed simply by importing it:

	 use No::Worries::Warn qw(warnf handler);

       Alternatively, it can be installed "manually":

	 use No::Worries::Warn qw(warnf);
	 $SIG{__WARN__} = \&No::Worries::Warn::handler;

FUNCTIONS
       This module provides the following functions (none of them being
       exported by default):

       warnf(MESSAGE)
	   report a warning described by the given MESSAGE

       warnf(FORMAT, ARGUMENTS...)
	   idem but with sprintf()-like API

       handler(MESSAGE)
	   $SIG{__WARN__} compatible warning handler (this function cannot be
	   imported)

GLOBAL VARIABLES
       This module uses the following global variables (none of them being
       exported):

       $Prefix
	   prefix to prepend to all warnings (default: the program name)

       $Syslog
	   true if warnings should also be sent to syslog using
	   No::Worries::Syslog's syslog_warning() (default: false)

ENVIRONMENT VARIABLES
       This module uses the "NO_WORRIES" environment variable to find out how
       warnings will be reported. Supported values are:

       "carp"
	   Carp's carp() will be used instead of warn()

       "cluck"
	   Carp's cluck() will be used instead of warn()

SEE ALSO
       Carp, No::Worries, No::Worries::Die, No::Worries::Syslog.

AUTHOR
       Lionel Cons <http://cern.ch/lionel.cons>

       Copyright CERN 2012

perl v5.14.3			  2012-12-19		  No::Worries::Warn(3)
[top]

List of man pages available for Fedora

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net