Module::Optimize(3pm)
β¨ NAME β¨
Module::Optimize β Perl Module Optimization π
π¦ SYNOPSIS π¦
okay so picture this: you're writing a module that compiles other modules. Here's the whole vibe. π
package Foo;
use Module::Optimize -base;
sub pmc_optimize {
my ($self, $source) = @_;
# Convert perl5 $source into semantically equivalent $compiled_output
return $compiled_output;
}
Then in Bar.pm:
package Bar;
use Foo;
or lexically, if you're feeling scoped and mysterious:
package Bar;
{
use Foo;
...
}
And to compile Bar.pm into Bar.pmc:
perl -c Bar.pm
π DESCRIPTION π
So this module hands you a whole system for writing modules that compile other Perl modules. Yes bestie, modules compiling modules. It's giving inception, it's giving meta, it's giving iconic. π
Here's the tea: any module that uses these compilation modules gets compiled into some altered form the very first time it's run. That result? cached straight into .pmc files. π
And the best part β Perl has native support for .pmc files. It always checks for them, every single time, before it goes and loads a .pm file. No cap. It's just built different. π
You get the following benefits:
πΈ SEE ALSO πΈ
Module::Compile
π AUTHORS π
- Ingy dΓΆt Net <ingy@cpan.org>
- Audrey Tang <audreyt@audreyt.org>
π COPYRIGHT AND LICENSE π
Copyright 2006-2019. Ingy dΓΆt Net.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
See <http://www.perl.com/perl/misc/Artistic.html>
real talk though π β the DESCRIPTION says "You get the following benefits:" and then justβ¦ doesn't list them. The page is like that fr fr. Not me editing the sacred text, so I'm leaving the cliffhanger exactly where it lives. π
mwah, that's a wrap, bestie π«Ά This little love letter came to you as one of the User Contributed Perl Documentation pages, running on perl v5.40.1, dated 2025-03-07, and filed under Module::Optimize(3pm). Go compile something cute. πβ¨
π¦ where this page comes from
- debian trixie: libmodule-compile-perl 0.38-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmodule-compile-perl 0.38-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmodule-compile-perl 0.38-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms