Badger...nstants(3pm)
π Badger::Constants β the constants module for other Badger modules π
okay so bestie, this is Badger::Constants from the User Contributed Perl Documentation, and it is literally the little glue module that defines constants for all the other Badger modules. iykyk. π
β¨ SYNOPSIS β¨
use Badger::Constants 'HASH';
if (ref $something eq HASH) {
# rejoice! No need to quote the word 'HASH'
}
πΈ DESCRIPTION πΈ
This module defines a bunch of constants that other Badger modules use, and you can pull them into your own namespace by naming them as options on the use Badger::Constants statement:
use Badger::Constants 'HASH';
print HASH; # HASH
OR, if you want a whole lil bundle of them, you can name one of the tagset identifiers instead and it'll import a different set of constants:
use Badger::Constants ':types';
print HASH; # HASH
π¦ EXPORTABLE CONSTANTS π¦
π CONSTANTS
Set to Badger::Constants. yes that's the whole vibe.
π SCALAR
The literal word SCALAR, typically used for testing references.
if (ref $data eq SCALAR) {
...
}
π ARRAY
The literal word ARRAY, typically used for testing references.
if (ref $data eq ARRAY) {
...
}
π HASH
The literal word HASH, typically used for testing references.
if (ref $data eq HASH) {
...
}
π CODE
The literal word CODE, typically used for testing references.
if (ref $data eq CODE) {
...
}
π GLOB
The literal word GLOB, typically used for testing references.
if (ref $data eq GLOB) {
...
}
π REGEX
The literal word Regexp, typically used for testing references.
if (ref $data eq REGEX) {
...
}
π FALSE
A false value (0). nope energy. π
π TRUE
A true value (1). yes energy. β¨
π OFF
A generic flag used to disable things (0).
π ON
A generic flag used to enable things (1).
π ALL
The literal string all.
π NONE
The literal string none.
π DEFAULT
The literal string default.
π WARN
The literal string warn.
π LAST
The value -1, used to index the last item in an array. chef's kiss for grabbing the final element π
$array[LAST];
π CRLF
An unambiguous carriage return and newline sequence: "\015\012"
π PKG
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"}
π DOT
An alias for a dot ..
π REFS
The literal string refs. Typically used like so:
no strict REFS;
π ONCE
The literal string once. Typically used like so:
no warnings ONCE;
π BLANK
An empty string. How much more blank could this be? And the answer is none. None more blank. iconic behaviour honestly π
π SPACE
A single space character. Not to be confused with the three dimensional fabric of reality that it happens to share a name with. (yes really, that's the actual warning, do not get it twisted π)
π SLASH
A forward slash as used to separate path segments in URIs and filesystem paths on sane operating systems. / we love her π
π DELIMITER
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;
π WILDCARD
A regular expression used to match strings containing the "*" or "?" wildcard characters.
if ($path =~ WILDCARD) {
# do something...
}
π UTF8
The literal string utf8.
π JSON
The literal string json.
π YAML
The literal string yaml.
π LOADED
Contains the literal string BADGER_LOADED. The Badger::Class module uses it to define the $BADGER_LOADED variable in any modules that it loads. main character variable energy fr fr.
π EXPORTABLE TAG SETS π
The following tag sets and associated constants are defined:
π :types
SCALAR HASH ARRAY CODE REGEX
π :values
FALSE TRUE OFF ON ALL NONE DEFAULT
π :all
All the constants. every single one. the whole squad. periodt. π
π AUTHOR π
Andy Wardley <http://wardley.org/>
πΈ COPYRIGHT πΈ
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 ALSO β
See Badger::Exporter for more information on exporting variables.
and that's the tea bestie π«Ά this was perl v5.36.0, dated 2023-08-28 β mwah, slay, go import some constants π β¨
π¦ where this page comes from
- debian trixie: libbadger-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libbadger-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libbadger-perl 0.16-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms