Module::Optimize(3pm)

πŸ“¦
version 0.38 Β· 5 versions
, in debian trixie, ubuntu resolute, ubuntu stonking

✨ 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 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