CPAN::Mini::Inject is a Perl module that was created to add additional distributions into a minicpan mirror.
While it was created for use with a minicpan mirror, similar functionality can be reused in other situations.
CPAN::Inject replicates the basics of this functionality.
Specifically, it takes an arbitrary tarball and adds it to the CPAN sources directory for a particular author, and then add the new file to the CHECKSUMS file.
It does not reimplement the logic to add files to the indexes.
The initial use this module was created for was to inject tarballs into the CPAN sources directory for the reserved LOCAL user, so that the can be installed via the CPAN shell, with automated recursion to CPAN dependencies.
But although the number of functions is limited (current only add exists, with the others to be added as needed) the implementation is very generic and sub-classable, so that it can be reused in other situations.
# Create the injector
my $cpan = CPAN::Inject->new(
sources => '/root/.cpan/sources', # Required field
author => 'LOCAL', # The default
# Add a file to the user
$cpan->add( file => 'some/random/Perl-Tarball-1.02.tar.gz' );
# What would have have to use when installing
# $path = 'LOCAL/Perl-Tarball-1.02.tar.gz';
my $path = $cpan->install_path( 'some/random/Perl-Tarball-1.02.tar.gz' );