NAME
App::MechaCPAN::Install - Mechanize the installation of CPAN modules.
SYNOPSIS
# Install Catalyst into local/
user@host:~$ mechacpan install Catalyst
DESCRIPTION
user@host:~$ mechacpan install Catalyst
The install
command is used for installing specific modules. All modules are installed into the local/
directory. It can accept module names in various formats. This includes:
# Install from:
foo-bar.tar.gz # * an archive
cpanfile # * a cpanfile
foo/ # * a directory that has a cpanfile
foo::bar # * a CPAN module
foo::bar@1.0 # * a specific module version
foo::bar~<1.0 # * a module with version < 1.0
BAZ/foo-bar.tar.gz # * a PAUSE URL
B/BA/BAZ/foo-bar.tar.gz # * a PAUSE URL
https://example.com/foo-bar.zip # * a URL
https://example.com/foo-bar.git # * a git repo
https://example.com/foo-bar.git@master # * a git branch
MetaCPAN is used to search for modules by name. If module name is provided, it will attempt to install from the current directory's cpanfile
.
Methods
go( \%opts, @srcs )
There is only a single public function that should be called. This will install the modules listed in @srcs
using the options in \%opts
. The options available are listed in the arguments section below.
# Example of calling go
App::MecahCPAN::Install->go({}, 'Try::Tiny');
Arguments
skip-tests
skip-tests-for
By default the tests of each module will be ran. If you do not want to run tests when installing modules, use this option. Alternatively, you can use skip-tests-for
to specify module names that will skip the tests for that module.
# Examples of --skip-tests
mechacpan install Try::Tiny --skip-tests
mechacpan install Catalyst --skip-tests-for=Moose
smart-tests
An alternative to skipping all tests is to try and be clever about which tests to run and which to skip. The smart-tests option will skip tests for any package that it considers pristine. It defines pristine modules as modules that only depend on modules that are either Core or other pristine modules that have been installed during the current run. This means that on a fresh install, no tests will be ran, whereas installing new modules will cause tests to be ran to make sure there are no issues.
This isn't a fool-proof system, tests are an important part of making sure that all modules installed play well. This option is most useful with App::MechaCPAN::Deploy and a cpanfile.snapshot
since the versions of packages listed in the snapshot file have been likely tested together so they are unlikely to have problems that would be revealed by running tests.
install-man
By default, man pages are not installed. Use this option to install the man pages.
source
Add a source translation to the installation. This can be used to translate a module name into another form, like using an exact version of a module or pull another module from its git repo. This can be repeated multiple times for multiple translations.
# Examples of --source
mechacpan install Catalyst --source Try::Tiny=ETHER/Try-Tiny-0.24
mechacpan install Catalyst --source Catalyst=git://git.shadowcat.co.uk/catagits/Catalyst-Runtime.git
only-sources
Do not use modules not listed in the source list. This means if you do not specify every module and every prerequisite in the source list, then it will not be installed. This doesn't sound very useful since you would be potentially listing hundreds of modules. However, this feature is mostly used in conjuncture with App::MechaCPAN::Deploy so that the modules listed in the cpanfile.snapshot
are the only module versions used.
update
If an older version of a given module is installed, a newer version will be installed. This is on by default.
Because to update is the default, the more useful option is false, or --no-update
from the command line. This will only install modules, not update modules to a newer version.
Note this option ONLY affects CPAN modules listed by package name, prerequisites and modules given not by package name are not affected by this option.
stop-on-error
If an error is encountered while processing an install, the default is to continue processing any module that isn't affected. Using this option will stop processing after the first error and not continue.
AUTHOR
Jon Gentle <cpan@atrodo.org>
COPYRIGHT
Copyright 2017- Jon Gentle
LICENSE
This is free software. You may redistribute copies of it under the terms of the Artistic License 2 as published by The Perl Foundation.