|
NAMENo::Worries - coding without worriesSYNOPSISuse No::Worries qw($HostName $ProgramName); printf("host is %s\n", $HostName); printf("program is %s\n", $ProgramName); DESCRIPTIONThis module and its sub-modules ease coding by providing consistent convenient functions to perform frequently used programming tasks.This module also exposes the $HostName and $ProgramName variables that represent what the sub-modules think the host name or program name is. These variables can be changed, if needed. PROGRAMMING STYLEERROR HANDLINGAll the functions die() on error so one does not have to worry about error checking: by default, any error will stop the code execution. The recommended way to catch errors is to use eval().For consistency, all the sub-modules use No::Worries::Die's dief() to report errors and No::Worries::Warn's warnf() to report warnings. The NO_WORRIES environment variable can be used to control how errors and warnings are reported (see No::Worries::Die and No::Worries::Warn). OPTION PASSINGAll the functions use the same consistent API with hashes to pass options like in:dir_make("/tmp/some/path", mode => 0770); This is a bit overkill when only one option is supported but it allows adding options later without breaking old code. The options can also be passed via a hash reference (this can be useful to avoid data copying): dir_make("/tmp/some/path", { mode => 0770 }); All the options are checked using Params::Validate. SYMBOL IMPORTINGAll the modules are "clean" in the sense that they do not import any symbol into the caller's namespace. All the needed symbols (usually functions) have to be explicitly imported like in:use No::Worries::Die qw(dief); In addition, all "normal" symbols can be imported at once using the asterisk character: use No::Worries::Log qw(*); MODULESHere are the relevant sub-modules and what they provide:
ENVIRONMENT VARIABLESThe No::Worries::Die and No::Worries::Warn modules use the "NO_WORRIES" environment variable to control how errors and warnings should be reported.GLOBAL VARIABLESThis module uses the following global variables (that can all be imported):
SEE ALSONo::Worries::Date, No::Worries::Die, No::Worries::Dir, No::Worries::DN, No::Worries::Export, No::Worries::File, No::Worries::Log, No::Worries::PidFile, No::Worries::Proc, No::Worries::Stat, No::Worries::String, No::Worries::Syslog, No::Worries::Warn, Params::Validate.AUTHORLionel Cons <http://cern.ch/lionel.cons>Copyright (C) CERN 2012-2019
Visit the GSP FreeBSD Man Page Interface. |