Badger...nstants(3pm)

πŸ“¦
version 0.16 Β· 4 versions
, in debian trixie, ubuntu noble, ubuntu resolute

πŸ‘‘ 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 (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