NAME

perl-migrate-modules - Migrate installed CPAN modules from one Perl to another

SYNOPSIS

perl-migrate-modules [OPTIONS] [<src-perl>] <dest-perl>

  perl-migrate-modules /path/to/perl-5.28.0 /path/to/perl-5.28.1
  perl-migrate-modules -nq -Ilib /usr/bin/perl ~/bin/perl
  perl-migrate-modules --from ~/perl5/lib/perl5 ~/perls/5.20.0

Options:
  -c, --include-core           Install core modules from source Perl
  -h, --help                   Show this message
  -f <path>, --from=<path>     Search only these path(s) for source modules
  -I <path>, --lib=<path>      Additional search path(s) for source modules
  -n, --notest                 Skip testing and test dependencies
  -q, --quiet                  Show only installation successes and failures
  -v, --version                Show the version of this script

DESCRIPTION

Reinstalls all modules found in the source Perl into the destination Perl, similar to the clone-modules command for perlbrew or the migrate-modules command for plenv. The Perls may be passed as paths to the base installation directory or paths to the perl executable itself. If only one path is passed, it will be used as both the source and destination, but the search and install paths can be influenced.

Modules are found in the source Perl's standard @INC search paths by default. To specify additional search paths, such as local::lib directories, use the -I/--lib option. To specify search paths to use and omit the standard search paths, use the -f/--from option.

Modules are installed to the destination Perl using cpanm. To influence the install location, activate a local::lib in your environment, or use the standard Perl and cpanm environment variables, such as "PERL_MM_OPT" in ExtUtils::MakeMaker, "PERL_MB_OPT" in Module::Build, and "PERL_CPANM_OPT" in cpanm.

EXAMPLES

  • Basic migration of modules to a newly installed Perl from an existing one:

    $ perl-migrate-modules /opt/perl-5.20.3 /opt/perl-5.22.0
  • Migrate modules from an old (inactive) local::lib directory, using /usr/bin/perl both to find source modules and to install:

    $ perl-migrate-modules --from ~/perl5-old/lib/perl5 /usr/bin/perl
  • Migrate modules from the sitelib of a Perl that can no longer be executed, using the active Perl executable both to find source modules and to install:

    $ perl-migrate-modules --from ~/.plenv/versions/5.24.0/lib/perl5/site_perl/5.24.0/ $(which perl)
  • Migrate modules to a custom local::lib location, using /opt/perl-5.28.0 to find modules within its search paths and using /opt/perl-5.28.1 to install to /opt/project/local:

    $ env PERL_CPANM_OPT='-l /opt/project/local' perl-migrate-modules /opt/perl-5.28.0 /opt/perl-5.28.1
  • Update all modules installed in the active Perl:

    $ perl-migrate-modules --include-core $(which perl)

CAVEATS

Only modules with .packlist will be migrated, this will include any module installed by CPAN clients, but generally not modules installed by vendor packages or core modules. Core modules available from CPAN can be included via Module::CoreList with the --include-core option.

Migrated modules will be installed at their latest indexed version, not the existing version when found.

Any environment settings that affect Perl's library search and module install locations, such as PERL5LIB or an active local::lib, will be ignored while searching for modules with the source Perl but will have their normal effect on installation into the destination Perl.

BUGS

Report any issues on the public bugtracker.

AUTHOR

Dan Book <dbook@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2018 by Dan Book.

This is free software, licensed under:

The Artistic License 2.0 (GPL Compatible)

SEE ALSO

"COMMAND: CLONE-MODULES" in perlbrew