CPANPL...st::MM(3pm)

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

πŸ’… CPANPLUS::Dist::MM β€” the manual, but make it make sense

okay bestie so real quick: this is the manual page for CPANPLUS::Dist::MM, which lives in section 3pm of the perl docs (User Contributed Perl Documentation, to be exact). It's the distribution class for MakeMaker-related modules. Let's get into it πŸ’–


✨ NAME ✨

CPANPLUS::Dist::MM β€” the distribution class for MakeMaker related modules. that's it, that's the name, slay πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

$mm = CPANPLUS::Dist::MM->new( module => $modobj );

$mm->create;        # runs make && make test
$mm->install;       # runs make install

see how simple? you make the object, you create, you install. main character energy fr fr πŸ’«


πŸ’– DESCRIPTION πŸ’–

so CPANPLUS::Dist::MM is a distribution class for MakeMaker related modules. using this package you can create, install and uninstall perl modules. and the way that it inherits from CPANPLUS::Dist? iconic. it's giving family tree, it's giving legacy 🫢


πŸŽ€ ACCESSORS πŸŽ€

  • parent() β€” hands you the CPANPLUS::Module object that parented this object. your origin story, basically πŸ’…
  • status() β€” hands you the Object::Accessor object that keeps the status for this module. the vibe tracker πŸ‘‘

🌸 STATUS ACCESSORS 🌸

all of these get accessed like this, no cap:

$mm->status->ACCESSOR
  • makefile () β€” where the Makefile (or Build file) lives. it gets set to 0 explicitly if something went wrong. that's the "oop πŸ™ˆ" value.
  • make () β€” a BOOL saying if the make (or Build) command was successful.
  • test () β€” a BOOL saying if the make test (or Build test) command was successful.
  • prepared () β€” a BOOL saying if the prepare call exited successfully. this one gets set after perl Makefile.PL.
  • distdir () β€” full path to the directory where the prepare call took place. gets set after a call to prepare.
  • created () β€” a BOOL saying if the create call exited successfully. gets set after make and make test.
  • installed () β€” a BOOL saying if the module was installed. gets set after make install (or Build install) exits successfully.
  • uninstalled () β€” a BOOL saying if the module was uninstalled properly.
  • _create_args () β€” storage for the arguments passed to create for this object. used for recursive calls when satisfying prerequisites. sneaky little helper πŸ”₯
  • _install_args () β€” storage for the arguments passed to install for this object. also used for recursive calls when satisfying prerequisites.

πŸ”₯ METHODS πŸ”₯

⭐ $bool = $dist->format_available();

returns a boolean telling you whether or not you can use this package to create and install modules in your environment. vibe check on your setup, basically πŸ’€

⭐ $bool = $dist->init();

sets up the CPANPLUS::Dist::MM object for use. effectively it creates all the needed status accessors.

it gets called automatically whenever you create a new CPANPLUS::Dist object, so you don't even have to ask 🧚

⭐ $bool = $dist->prepare([perl => '/path/to/perl', makemakerflags => 'EXTRA=FLAGS', force => BOOL, verbose => BOOL])

prepare preps a distribution for installation. translation: it runs perl Makefile.PL and figures out what prerequisites this distribution declared. doing the groundwork, bestie 🌈

if you set force to true, it goes over all the stages of the prepare process again, ignoring any previously cached results. no shortcuts, no memory πŸ’…

when running perl Makefile.PL, the environment variable PERL5_CPANPLUS_IS_EXECUTING gets set to the full path of the Makefile.PL that is being executed. this lets any code inside the Makefile.PL know that it's being installed via CPANPLUS. it's literally telling on itself 🫢

returns true on success and false on failure.

you may then call $dist->create on the object to create the installable files.

⭐ $href = $dist->_find_prereqs( file => '/path/to/Makefile', [verbose => BOOL])

parses a Makefile for PREREQ_PM entries and distills from that any prerequisites mentioned in the Makefile. detective work πŸ•΅οΈβ™€οΈ

returns a hash with module-version pairs on success and false on failure.

⭐ $bool = $dist->create([perl => '/path/to/perl', make => '/path/to/make', makeflags => 'EXTRA=FLAGS', prereq_target => TARGET, skiptest => BOOL, force => BOOL, verbose => BOOL])

create creates the files necessary for installation. it runs make and make test, and it'll also scan for and attempt to satisfy any prerequisites the module may have. multitasking queen πŸ‘‘

if you set skiptest to true, it skips the make test stage. if you set force to true, it goes over all the stages of the make process again, ignoring any previously cached results. it will also ignore a bad return value from make test and still allow the operation to return true. bold. risky. iconic πŸ”₯

returns true on success and false on failure.

you may then call $dist->install on the object to actually install it.

⭐ $bool = $dist->install([make => '/path/to/make', makemakerflags => 'EXTRA=FLAGS', force => BOOL, verbose => BOOL])

install runs this command, verbatim:

make install

returns true on success, false on failure. periodt πŸ’…

⭐ $bool = $dist->write_makefile_pl([force => BOOL, verbose => BOOL])

this routine can write a Makefile.PL from the information in a module object. it's used to write a Makefile.PL when the original author forgot it (!!). not me fixing someone else's homework 😭

returns 1 on success and false on failure.

the file gets written to the directory the module's been extracted to.


heads up bestie: that (!!) up there is the original author's energy, not mine. the forgotten-Makefile.PL situation is real and it is a mess πŸ™ˆ

and that's the whole page!! you now know CPANPLUS::Dist::MM better than it knows itself. go forth and create, install, and maybe uninstall πŸ’–

β€” sign-off from your fave: this was perl v5.40.1, dated 2025-03-01. no cap, that's the version, that's the date, love that for us πŸŽ€βœ¨πŸ¦‹

πŸ“¦ where this page comes from