PerlX::Define(3pm)

πŸ“¦
version 0.101 Β· 3 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu questing

πŸ’– PerlX::Define πŸ’–

the cutest lil syntax for defining constants, bestie ✨

This is PerlX::Define, a page from the User Contributed Perl Documentation section of your manual (section 3pm, for the perl girls who were wondering). It's a Perl module. It defines constants. It does it adorably. Let's get into it πŸŽ€


🌸 NAME 🌸

PerlX::Define β€” cute syntax for defining constants πŸ’…


✨ SYNOPSIS ✨

okay so here's the whole vibe, look at this:

use v5.12;
use strict;
use warnings;

package MyMaths {
   use PerlX::Define;
   define PI = 3.2;
}

that's IT. that's the whole thing. no sub , no => , no drama. πŸ¦‹


πŸ’œ DESCRIPTION πŸ’œ

ngl bestie, PerlX::Define is yet another module for defining constants. There are, like, others. We know. But here's what makes this one different from constant.pm, and we're gonna go through every single one because that's the whole point:

  • Cute syntax. πŸ’–

Just like constant.pm, the constants get defined at compile time, not run time. So they're, like, already there before anything even runs. iconic.

  • Requires Perl 5.12 or above. ⭐

If you're lucky enough to be able to free yourself from the shackles of supporting decade-old versions of Perl, then PerlX::Define is your friend. 🫢 (that's a direct quote from the module's own heart, we love a self-aware queen)

  • Only supports scalar constants. 🌈

List constants are rarely useful β€” lowkey true, we don't make the rules.

Your constant can of course be a reference to an array or hash, but this module does not attempt to make the referred-to structure read only. so like, the reference itself is locked in, the stuff inside it is very much not. just so you know 🫠

  • Doesn't try to handle some of the things constant.pm does β€” like declaring constants using fully-qualified names, or defining constants pointing at magic scalars. we're keeping it simple, bestie. it's giving minimalist.

πŸ“œ little lore drop πŸ“œ

Prior to version 0.100, PerlX::Define was bundled with Moops. that's the origin story 🧚


πŸ› BUGS πŸ›

found a bug? PLEASE report it, we're begging 😭 β€” please report any bugs to:

http://rt.cpan.org/Dist/Display.html?Queue=PerlX-Define

(that's the link, click it, tell them everything) πŸ’Œ


πŸ‘€ SEE ALSO πŸ‘€

  • constant β€” the classic, the blueprint, the OG πŸŽ€
  • Moops β€” its former home, its roots 🌱

πŸ‘‘ AUTHOR πŸ‘‘

Toby Inkster <tobyink@cpan.org>

shoutout to the author, we stan πŸ’–


This software is copyright (c) 2013-2014, 2018 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay, open source, we love to see it ✨


πŸ’€ DISCLAIMER OF WARRANTIES πŸ’€

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

translation: no promises, bestie. it is what it is. 🫢


and that's the page!! this doc came from perl v5.36.0, dated 2022-12-06, and it lives in the PerlX::Define(3pm) manpage β€” mwah, go define some constants, you absolute main character πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from