NAME
App::GitFind::Base - base definitions for App::GitFind
SYNOPSIS
use App::GitFind::Base;
Imports the functions described herein. Does not set strict and warnings in the caller, since invoking modules have to do so on their own anyway for the sake of Kwalitee.
VARIABLES
$QUIET
Set to a truthy value to disable logging via "vlog". Overrides "$VERBOSE". Exported as *QUIET
so that it can be local
ized.
$VERBOSE
Set to a positive integer to enable logging via "vlog". Exported as *VERBOSE
so that it can be local
ized.
FUNCTIONS
_qwc
qw(), but permitting comments. Call as _qwc(<<EOT)
. Thanks to ideas at https://www.perlmonks.org/?node=qw%20comments . Prototyped as ($)
.
Has a leading underscore because for some reason that makes my syntax files happier!
getparameters
An alias of the parameters()
function from Getargs::Mixed, but with -undef_ok
set.
ddc
"ddc" in Data::Dumper::Compact, but lazily loads Data::Dumper::Compact
.
croak
As "croak" in Carp, but lazily loads Carp
.
vlog
Log information to STDERR if "$VERBOSE" is set. Usage:
vlog { <list of things to log> }
[optional min verbosity level (default 1)]
[, log-routine args];
The items in the list are joined by ' '
on output, and a '\n'
is added. Each line is prefixed with '# '
for the benefit of test runs. To break the list across multiple lines, specify \n
at the beginning of a list item.
The list is in {}
so that it won't be evaluated if logging is turned off. It is a full block, so you can run arbitrary code to decide what to log. If the block returns an empty list, vlog will not produce any output. However, if the block returns at least one element, vlog will produce at least a '# '
.
The message will be output only if "$VERBOSE" is at least the given minimum verbosity level (1 by default).
If $VERBOSE >= 4
, the filename and line from which vlog was called will also be printed.
If more arguments are provided than two, the extras are the arguments to the subroutine. This permits you to pass arguments from the caller's @_
that would otherwise be shadowed inside the logging routine. E.g.:
sub foo {
vlog { $_[0] } 1, $_[1]; # log foo's $_[1]
}
vwarn
As "vlog", but warns regardless of "$VERBOSE". Does respect "$QUIET".
import
See "SYNOPSIS"
AUTHOR
Christopher White, <cxw at cpan.org>
LICENSE AND COPYRIGHT
Copyright 2019 Christopher White. Portions copyright 2019 D3 Engineering, LLC.
This program is distributed under the MIT (X11) License: http://www.opensource.org/licenses/mit-license.php
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.