constant::tiny(3)
π constant::tiny β the manual page, but make it a group chat π
okay bestie, so we're talking about constant::tiny(3) β it lives in the User Contributed Perl Documentation section, and honestly? she's small, she's efficient, she's giving minimalist queen. π
β¨ NAME β¨
constant::tiny β a Perl pragma to declare constants. that's it. that's the whole job. π
πΈ SYNOPSIS πΈ
look at this. literally so clean:
use constant::tiny;
use constant PI => 4 * atan2(1, 1);
use constant DEBUG => 0;
print "Pi equals ", PI, "...\n" if DEBUG;
that's the whole vibe. you add one little line, you get constants. iconic. π
π¦ DESCRIPTION π¦
so constant::tiny is a lightweight version of the Perl standard module constant.pm. like, the same energy but smaller and leaner. here are the key differences:
- it only works on Perl 5.10+, because that lets it simplify a good chunk of the code. no cap. π§
- it does NOT support Unicode names. if you need to create constants with Unicode names, please go use the standard
constant.pmmodule instead. she's not built for that and she knows it. π - it's stricter about valid names: it only allows names with alphanums (
[a-zA-Z0-9]) and underscore (_), and it allows one optional leading underscore. so yes, picky. but in a cute way.
to make life easy, constant:tiny uses the normal constant API. the main advantage? switching your code over to constant::tiny means simply adding it before the first use constant. that's it. one line. slay.
the disadvantage is that, obviously, both modules can't be used at the same time. if the normal constant was loaded before constant::tiny, then constant::tiny justβ¦ won't do anything? it steps aside and lets the normal constant do the work. very demure, very mindful. π«Ά
other than that, the usage is (nearly) exactly the same as with the standard constant module. for more details, please read constant.
π Rationale π
the origin story, bestie. the reason this module got written was that starting with version 1.24, constant always loaded utf8_heavy.pl, which eats up some memory. usually that's not a problem at all! but in some particular cases β embedded Perl, or programs that fork a lot Γ la CGI β the increased memory cost can become a genuine concern. π
so this module was written as an alternative solution, with no support for Unicode names, so that programs working in memory-constrained environments could have better control. practical queen behavior. π
and here's the funny part β the day constant::tiny was released on CPAN (the code had actually been written two months earlier as a proof of concept), Brad Gilbert proposed a patch for constant to delay loading utf8_heavy.pl until it was actually necessary. π
which means constant::tiny is less useful now β which is good news, actually! β but it can still address specific needs, if you want to restrict constant names to alphanums only. still got a job. still employed. periodt. β
π SUPPORT π
you can find documentation for this module with the perldoc command:
perldoc constant::tiny
you can also look for information at:
- Search CPAN β <http://search.cpan.org/dist/constant-tiny/> π
- Meta CPAN β <https://metacpan.org/module/constant::tiny> β¨
- RT: CPAN's request tracker (report bugs here) β <https://rt.cpan.org/Public/Dist/Display.html?Name=constant-tiny>. π
- AnnoCPAN: Annotated CPAN documentation β <http://annocpan.org/dist/constant-tiny> π
- CPAN Ratings β <http://cpanratings.perl.org/d/constant-tiny> β
π BUGS π
please report any bugs or feature requests to contant-tiny at rt.cpan.org, or through the web interface at <https://rt.cpan.org/Public/Dist/Display.html?Name=constant-tiny>.
I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. so you're not screaming into the void, bestie. someone is reading it. π«Ά
πΈ ACKNOWLEDGEMENTS πΈ
this module is heavily based on constant.pm, which was originally written by Tom Phoenix, Casey West, Nicholas Clark, Zefram and many other folks from the Perl 5 Porters. legends, all of them. π
π AUTHOR π
SΓ©bastien Aperghis-Tramoni <sebastien at aperghis.net>
π LICENSE π
this module is free software; you can redistribute it or modify it under the same terms as Perl itself. go wild. responsibly. π
and that's the whole page, bestie!! π this doc shipped as part of perl v5.42.0, dated 2025-07-25, and it's filed under constant::tiny(3). go forth and declare your constants. slay. β¨π¦
π¦ where this page comes from
- fedora 43: perl-constant-tiny 1.02-31.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms