NAME
CPAN::Mini::Inject - Inject modules into a CPAN::Mini mirror.
Version
Version 0.23
Synopsis
If you're not going to customize the way CPAN::Mini::Inject works, you probably want to look at the mcpani command, instead.
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;
Description
CPAN::Mini::Inject uses CPAN::Mini to build or update a local CPAN mirror then adds modules from your repository to it, allowing the inclusion of private modules in a minimal CPAN mirror.
Methods
Each method in CPAN::Mini::Inject returns a CPAN::Mini::Inject object which allows method chaining. For example:
my $mcpi=CPAN::Mini::Inject->new;
$mcpi->pasrsecfg
->update_mirror
->inject;
new()
Create a new CPAN::Mini::Inject object.
loadcfg()
loadcfg accepts a CPAN::Mini::Inject config file or if not defined will search the following four places in order:
file pointed to by the environment variable MCPANI_CONFIG
$HOME/.mcpani/config
/usr/local/etc/mcpani
/etc/mcpani
loadcfg sets the instance variable cfgfile to the file found or undef if none is found.
print "$mcpi->{cfgfile}\n"; # /etc/mcpani
parsecfg()
parsecfg reads the config file stored in the instance variable cfgfile and creates a hash in config with each setting.
$mcpi->{config}{remote} # CPAN sites to mirror from.
parsecfg expects the config file in the following format:
local: /www/CPAN
remote: ftp://ftp.cpan.org/pub/CPAN ftp://ftp.kernel.org/pub/CPAN
repository: /work/mymodules
passive: yes
dirmode: 0755
Description of options:
local
location to store local CPAN::Mini mirror (*REQUIRED*)
remote
CPAN site(s) to mirror from. Multiple sites can be listed space separated. (*REQUIRED*)
repository
Location to store modules to add to the local CPAN::Mini mirror.
passive
Enable passive FTP.
dirmode
Set the permissions of created directories to the specified mode. The default value is based on umask if supported.
If either local or remote are not defined parsecfg croaks.
testremote()
Test each site listed in the remote parameter of the config file by performing a get on each site in order for authors/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 of CPAN::Mini.
add()
Add a new module to the repository. The add method copies the module file into the repository with the same structure as a CPAN site. For example CPAN-Mini-Inject-0.01.tar.gz is copied to MYCPAN/authors/id/S/SS/SSORICHE. add creates the required directory structure below the repository.
module
The name of the module to add.
authorid
CPAN author id. This does not have to be a real author id.
version
The modules version number.
file
The tar.gz of the module.
Example
add( module => 'Module::Name',
authorid => 'AUTHOR',
version => 0.01,
file => './Module-Name-0.01.tar.gz' );
inject()
Insert modules from the repository into the local CPAN::Mini mirror. inject copies each module into the appropriate directory in the CPAN::Mini mirror and updates the CHECKSUMS file.
Passing a value to inject
enables verbose mode, which lists each module as it's injected.
updpackages()
Update the CPAN::Mini mirror's modules/02packages.details.txt.gz with the injected module information.
updauthors()
Update the CPAN::Mini mirror's authors/01mailrc.txt.gz with stub information should the author not actually exist on CPAN
readlist()
Load the repository's modulelist.
writelist()
Write to the repository modulelist.
See Also
"/github.com/ssoriche/cpan--mini--inject/tree/master"" in <a href="http:Source Repository</a>>
Author
Shawn Sorichetti, <ssoriche@cpan.org>
Acknowledgements
Special thanks to David Bartle, for bringing this module up to date, and resolving the reported bugs.
Bugs
Please report any bugs or feature requests to bug-cpan-mini-inject@rt.cpan.org
, or through the web interface at http://rt.cpan.org. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
Copyright & License
Copyright 2008 Shawn Sorichetti, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.