unconstant(3pm)

πŸ“¦ version 0.09, in ubuntu resolute, ubuntu stonking

πŸ’– 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>


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