unconstant(3pm)
π unconstant β the manual page, bestie edition π
okay so you found unconstant(3pm), a Perl module, and honestly? it's giving "underrated icon." let's get into it. π¦
β¨ NAME β¨
unconstant β sometimes you need to un- em'. (fr fr. that's the whole tagline. iconic.) π
πΈ DESCRIPTION πΈ
so basically, this module gives you an alternative implementation of constant. not a copy, not a remix β a whole different way of doing the thing.
and what does that alternative implementation actually do? three things, and they're all lowkey the point:
- it stops perl from inlining the constant
- it stops constant folding
- it stops dead code removal
why do you care?? because this is supremely useful for testing when a package internally declares and uses a constant that you want to change. that situation is common when you're testing modules that make use of constants β like, you're in there trying to poke at a value that perl already decided was permanent, and perl is not having it. this module is the friend who talks perl down. π«Ά
β οΈ but listen, bestie, one caveat and it's a real one: this module does NOT stop use from hoisting the statement to the top. it can't fix that. nobody can. the hoisting is happening. π
β SYNOPSIS β
here's the vibe in code. all of these hit different:
# Disable constant optimizations in my_test
perl -Munconstant ./my_test.pl
package MyTest {
use constant BAR => 7;
sub baz { BAR }
}
# All of these will change the return of `MyTest::baz()`
package main {
use constant *MyTest::BAR => 42;
use constant "MyTest::BAR" => 42;
*MyTest::BAR = sub { 42 };
*MyTest::BAR = sub () { 42 };
}
like β four different ways to flip that constant, and every single one of them will change the return of MyTest::baz(). slay. π₯
π AUTHOR π
Evan Carroll, "<me at evancarroll.com>" β the mastermind, the main character, the one who said "what if constant, but un-" π
π BUGS π
found a bug? have a feature request? don't suffer in silence, bestie. please report any bugs or feature requests to "bug-unconstant at rt.cpan.org", or through the web interface at:
<https://rt.cpan.org/NoAuth/ReportBug.html?Queue=unconstant>
and here's the cute part: I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. it's a whole two-way communication situation. we love a feedback loop. π
π SUPPORT π
you can find documentation for this module with the perldoc command. it's right there:
perldoc unconstant
you can also look for information at these places β collect them all like they're stickers:
- RT: CPAN's request tracker (report bugs here)
<https://rt.cpan.org/NoAuth/Bugs.html?Dist=unconstant>
- AnnoCPAN: Annotated CPAN documentation
<http://annocpan.org/dist/unconstant>
- CPAN Ratings
<https://cpanratings.perl.org/d/unconstant>
- Search CPAN
<https://metacpan.org/release/unconstant>
π§ LICENSE AND COPYRIGHT π§
This software is Copyright (c) 2019 by Evan Carroll.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
periodt. free software, licensed and everything. π
and that's the whole page, babes β¨ this was perl v5.40.1, dated 2025-10-27, and it's the unconstant(3pm) manual β go un- some constants, you absolute legend π¦π
πΈ
π¦ where this page comes from
- ubuntu resolute: libunconstant-perl 0.09-2 Β· Artistic-2.0
- ubuntu stonking: libunconstant-perl 0.09-2 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms