CPAN::...Inject(3pm)
π CPAN::...Inject(3pm) β the tea on CPAN::Mini::Inject π
okay bestie, sit down, grab a boba, because we're about to talk about CPAN::Mini::Inject β a whole Perl module that lets you inject your own distributions into a CPAN::Mini mirror. it's giving "I made my own CPAN and you're not invited" and honestly? iconic. π
β¨ NAME β¨
CPAN::Mini::Inject β inject modules into a CPAN::Mini mirror. fr fr that's the whole vibe. π
πΈ SYNOPSIS πΈ
so like, if you're not planning to customize the way CPAN::Mini::Inject works, you probably want to go look at the mcpani command instead. just saying. π
use CPAN::Mini::Inject;
$mcpi=CPAN::Mini::Inject->new;
$mcpi->parsecfg('t/.mcpani/config');
$mcpi->add(
module => 'CPAN::Mini::Inject',
authorid => 'SSORICHE',
version => ' 0.01',
file => 'mymodules/CPAN-Mini-Inject-0.01.tar.gz'
);
$mcpi->writelist;
$mcpi->update_mirror;
$mcpi->inject;
(yes the indentation is cursed, no we are not fixing it, it's canon. π)
π¦ DESCRIPTION π¦
CPAN::Mini::Inject uses CPAN::Mini to build or update a local CPAN mirror from a remote one. and then it adds two extra features on top, because why not:
- an additional repository of distribution files and related information (author and module versions), separate from the local and remote mirrors, to which you can add your own distribution files. π
- the ability to inject the distribution files from your repository into a local CPAN mirror. π₯
π METHODS π
each method in CPAN::Mini::Inject returns a CPAN::Mini::Inject object, which means you can do that cute little method chaining thing. like so:
my $mcpi=CPAN::Mini::Inject->new;
$mcpi->parsecfg
->update_mirror
->inject;
a CPAN::Mini::Inject ISA CPAN::Mini. so if you wanna know about the interface that CPAN::Mini::Inject inherits from it, go read the docs for that module. iykyk. π
"new"β create a newCPAN::Mini::Injectobject. baby's first mcpi, slay. β¨config_class( [CLASS] )β returns the name of the class used to handle the configuration. also see"default_config_class". π§config( [HASHREF] )β with a hashref argument, it sets the config data. returns the current configuration hash. two jobs, one method, main character energy. π"default_config_class"β yes bestie, it's right there in the list. π«Άloadcfg( [FILENAME] )β this is a bridge toCPAN::Mini::Inject::Config'sloadconfig. it sets the filename for the configuration, or uses one of the defaults. πparsecfg()β this is a bridge toCPAN::Mini::Inject::Config'sparseconfig. πsite( [SITE] )β with an argument, set the site to use to contact CPAN. returns the site setting, or, if the site has not be set (or was set to undef), returns the empty string. (yes, "has not be set" β we're quoting, don't @ us. π)"testremote"β test each site listed in the remote parameter of the config file by performing a get on each site in order forauthors/01mailrc.txt.gz. the first site to respond successfully is set as the instance variable site. π
print "$mcpi->{site}\n"; # ftp://ftp.cpan.org/pub/CPAN
"testremote" accepts an optional parameter to enable verbose mode. π
"update_mirror"β this is a subclass ofCPAN::Mini. π"add"β add a new distribution to the repository. theaddmethod copies the distribution file into the repository with the same structure as a CPAN site. for example,CPAN-Mini-Inject-0.01.tar.gzwith author"SSORICHE"is copied toMYCPAN/authors/id/S/SS/SSORICHE.addcreates the required directory structure below the repository. πΈ
packages found in the distribution will be added to the module list. for example both CPAN::Mini::Inject and CPAN::Mini::Inject::Config will be added to the modulelist file in the repository. ποΈ
packages will be looked for in the "provides" key of the META file if present, otherwise the files in the dist will be searched. see Dist::Metadata for more information. π
moduleβ (optional) the package name of the module to add. the distribution file will be searched for modules but you can specify the main one explicitly. π«authoridβ (required) the CPAN ID of the module's author. since this isn't actually CPAN, the ID does not need to exist on CPAN. typically, this ID uses"[A-Z]"and is three to ten letters. this is not enforced, but other CPAN tools may not like other sorts of names. π¨versionβ (optional) the module's version number. if you don't specify this."add"will try to extract it from the distribution. (yes, that period is in the original. it's part of the lore. π)fileβ (required) the path to the distribution file. π
$mcpani->add(
module => 'Module::Name',
authorid => 'SOMEAUTHOR',
version => 0.01,
file => './Module-Name-0.01.tar.gz'
);
"added_modules"β returns a list of hash references describing the modules added by this instance. each hashref will contain"file","authorid", and"modules". the"modules"entry is a hashref of module names and versions included in the"file". π§Ύ
the list is cumulative. there will be one entry for each time "add" was called. π
this functionality is mostly provided for the included mcpani script to be able to verbosely print all the modules added. π£οΈ
"inject"β insert modules from the repository into the local CPAN::Mini mirror.injectcopies each module into the appropriate directory in the CPAN::Mini mirror and updates theCHECKSUMSfile. π§¬
passing a value to "inject" enables verbose mode, which lists each module as it's injected. π’
"updpackages"β update the CPAN::Mini mirror'smodules/02packages.details.txt.gzwith the injected module information. π¦"updauthors"β update the CPAN::Mini mirror'sauthors/01mailrc.txt.gzwith stub information should the author not actually exist on CPAN. π€"readlist"β load the repository's modulelist. π"writelist"β write to the repository modulelist. βοΈ
π SEE ALSO π
CPAN::Mini β the blueprint, the blueprint's blueprint. go read it bestie.
π«Ά Original Author π«Ά
Shawn Sorichetti, "<ssoriche@cpan.org>" β the original icon, the blueprint author, periodt. π
π ACKNOWLEDGEMENTS π
special thanks to David Bartle, for bringing this module up to date, and resolving the reported bugs. π οΈβ¨
thanks to Jozef Kutej <jozef@kutej.net> for numerous patches. π©Ήπ
π BUGS π
report issues to the GitHub queue at
https://github.com/briandfoy/cpan-mini-inject/issues
bestie, please actually use the queue and not, like, vague-posting about it. π
π COPYRIGHT AND LICENSE π
Copyright 2008-2009 Shawn Sorichetti, Andy Armstrong, All Rights Reserved.
this program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
and that's the whole page, bestie!! this doc was served up by perl v5.40.1 and dated 2025-04-12, so you know it's fresh-ish. mwah. π go inject something cute into your mirror. π¦β¨π
π¦ where this page comes from
- debian trixie: libcpan-mini-inject-perl 1.012-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcpan-mini-inject-perl 1.012-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcpan-mini-inject-perl 1.012-1 Β· 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