Badger::Constants - defines constants for other Badger modules
use Badger::Constants 'HASH'; if (ref $something eq HASH) { # rejoice! No need to quote the word 'HASH' }
This module defines a number of constants used by other Badger modules. They can be imported into the caller's namespace by naming them as options to the use Badger::Constants statement:
Badger
use Badger::Constants
use Badger::Constants 'HASH'; print HASH; # HASH
Alternatively, one of the tagset identifiers may be specified to import different sets of constants.
use Badger::Constants ':types'; print HASH; # HASH
Set to Badger::Constants.
Badger::Constants
The literal word SCALAR, typically used for testing references.
SCALAR
if (ref $data eq SCALAR) { ... }
The literal word ARRAY, typically used for testing references.
ARRAY
if (ref $data eq ARRAY) { ... }
The literal word HASH, typically used for testing references.
HASH
if (ref $data eq HASH) { ... }
The literal word CODE, typically used for testing references.
CODE
if (ref $data eq CODE) { ... }
The literal word GLOB, typically used for testing references.
GLOB
if (ref $data eq GLOB) { ... }
The literal word Regexp, typically used for testing references.
Regexp
if (ref $data eq REGEX) { ... }
A false value (0)
A true value (1)
A generic flag used to disable things (0).
A generic flag used to enable things (1).
The literal string all.
all
The literal string none.
none
The literal string default.
default
The literal string warn.
warn
The value -1, used to index the last item in an array.
-1
$array[LAST];
An unambiguous carriage return and newline sequence: \015\012
\015\012
An alias for the :: symbol used to delimiter Perl packages. Typically used to construct symbol references.
::
use Badger::Constants 'PKG'; use constant EXAMPLE => 'EXAMPLE'; my $var = ${ $pkg.PKG.EXAMPLE }; # same as: ${"${pkg}::EXAMPLE"}
An alias for a dot ..
.
The literal string refs. Typically used like so:
refs
no strict REFS;
The literal string once. Typically used like so:
once
no warnings ONCE;
An empty string. How much more blank could this be? And the answer is none. None more blank.
A single space character. Not to be confused with the three dimensional fabric of reality that it happens to share a name with.
A forward slash as used to separate path segments in URIs and filesystem paths on sane operating systems.
A regular expression used to split whitespace delimited tokens. Also accepts commas with optional trailing whitespace as a delimiter.
$names = [ split DELIMITER, $names ] unless ref $names eq ARRAY;
A regular expression used to match strings containing the * or ? wildcard characters.
*
?
if ($path =~ WILDCARD) { # do something... }
The literal string utf8.
utf8
The literal string json.
json
The literal string yaml.
yaml
Contains the literal string BADGER_LOADED. The Badger::Class module uses it to define the $BADGER_LOADED variable in any modules that it loads.
BADGER_LOADED
$BADGER_LOADED
The following tag sets and associated constants are defined:
SCALAR HASH ARRAY CODE REGEX
FALSE TRUE OFF ON ALL NONE DEFAULT
All the constants.
Andy Wardley http://wardley.org/
Copyright (C) 1996-2009 Andy Wardley. All Rights Reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See Badger::Exporter for more information on exporting variables.
To install Badger, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Badger
CPAN shell
perl -MCPAN -e shell install Badger
For more information on module installation, please visit the detailed CPAN module installation guide.