CPANPLUS::Dist(3pm)

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

✨ CPANPLUS::Dist β€” the base class for plugins, bestie πŸ’…

okay so this is CPANPLUS::Dist, and it's the base class for plugins. that's the whole vibe. it's the blueprint, the mother, the main character that all the dist-type girlies inherit from. 🫢


🌸 SYNOPSIS 🌸

my $dist = CPANPLUS::Dist::YOUR_DIST_TYPE_HERE->new(
                            module  => $modobj,
                        );

like... that's it. that's the whole entrance. iconic. ✨


πŸ’– DESCRIPTION πŸ’–

so CPANPLUS::Dist is the base class for CPANPLUS::Dist::MM and CPANPLUS::Dist::Build. if you're a dev cooking up your own CPANPLUS::Dist::* plugin, bestie, you should go look at CPANPLUS::Dist::Base β€” that's your blueprint. periodt. πŸ’…


πŸŽ€ ACCESSORS πŸŽ€

  • parent() β€” hands you back the CPANPLUS::Module object that parented this object. your origin story, fr. πŸ‘‘
  • status() β€” returns the Object::Accessor object that keeps the status for this module. it's the little diary where everything gets written down. πŸ““

πŸ¦‹ STATUS ACCESSORS πŸ¦‹

all of these can be reached like this:

$deb->status->ACCESSOR

so yes, you go through status first. it's giving backstage pass. 🎟️

  • created() β€” boolean saying whether the dist was created successfully or not. it gets explicitly set to 0 when it fails, so if you see undef you should read that as "not yet attempted". not a fail, just... not yet, bestie. πŸ™ˆ
  • installed() β€” boolean for whether the dist installed successfully. same rules: explicitly 0 on failure, so undef means "not yet attempted". πŸ“
  • uninstalled() β€” boolean for whether the dist uninstalled successfully. and again: explicitly 0 when it fails, so undef = "not yet attempted". consistent queen. πŸ’œ
  • dist() β€” the location of the final distribution. heads up: this might be a file or a directory, depending on how your distribution plugin of choice works. it gets set once a create succeeds. 🌈

⭐ the methods, let's go ⭐

πŸ’« $dist = CPANPLUS::Dist::YOUR_DIST_TYPE_HERE->new( module => MODOBJ );

makes a brand new CPANPLUS::Dist::YOUR_DIST_TYPE_HERE object based on the MODOBJ you hand it. 🫢

🚨 * DEPRECATED * 🚨 the optional argument format is used to say what type of dist you wanna create (like CPANPLUS::Dist::MM or CPANPLUS::Dist::Build and so on). it's deprecated, so like... don't build your whole personality around it, okay?

and important: CPANPLUS::Dist->new is exclusively meant as a method to be inherited by CPANPLUS::Dist::MM|Build. it's not for you to call directly, it's for the children. πŸ’€

returns a CPANPLUS::Dist::YOUR_DIST_TYPE_HERE object on success, and false on failure. slay or flop, no in between. ✨


πŸ’« @dists = CPANPLUS::Dist->dist_types;

returns a list of the CPANPLUS::Dist::* classes that are available. the whole roster. the lineup. πŸ‘‘


πŸ’« $bool = CPANPLUS::Dist->rescan_dist_types;

rescans @INC for available dist types. super useful if you just installed some new CPANPLUS::Dist::* classes and you want the current process to actually know about them. refresh the vibe check, bestie. πŸ”„


πŸ’« $bool = CPANPLUS::Dist->has_dist_type( $type )

returns true if the distribution type $type is loaded/supported. yes or no, that's the tea. 🍡


πŸ’« $bool = $dist->prereq_satisfied( modobj => $modobj, version => $version_spec )

returns true if this prereq is satisfied, false if it's not. also throws an error if it seems "unsatisfiable" β€” meaning it can't be found on CPAN, or the latest CPAN version just doesn't satisfy it. 😭 like it's not being difficult on purpose, it's genuinely impossible.


πŸ’« $configure_requires = $dist->find_configure_requires( [file => /path/to/META.yml] )

reads the configure_requires for this distribution from the META.yml or META.json file sitting in the root directory, and returns a hashref with the module names and versions required. receipt printer energy. 🧾✨


πŸ’« $bool = $dist->_resolve_prereqs( ... )

makes sure the prerequisites are actually resolved. no loose ends. πŸ’… here's what you can pass:

  • format β€” the dist class to use to make the prereqs (ie. CPANPLUS::Dist::MM).
  • prereqs β€” hash of the prerequisite modules and their versions.
  • target β€” what to actually do with the prereqs:
    • create => just build them
    • install => install them
    • ignore => ignore them πŸ™ˆ
  • prereq_build β€” if true, always build the prereqs even if they're already resolved. extra. thorough. we love her.
  • verbose β€” be verbose. tell me everything, bestie. πŸ—£οΈ
  • force β€” force the prereq to be built, even if it's already resolved. no cap. πŸ”₯

and that's the page, babes. this little masterpiece is perl v5.40.1, dated 2025-03-01, and it lives its life as CPANPLUS::Dist(3pm) β€” go forth and build ur dists, you absolute icon. πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from