NAME

eachperl - a wrapper script for iterating multiple perl binaries

SYNOPSIS

$ eachperl exec -E 'say "Hello"'

  --- perl5.30.0 --- 
Hello

  --- bleadperl --- 
Hello

----------
perl5.30.0          : 0
bleadperl           : 0

DESCRIPTION

This script iterates over a collection of multiple perl installations, allowing the same command to be invoked across each of them. The list of available perl binaries is given by a config file (see "CONFIG"). The main mode of operation is that each perl binary in turn is executed with supplied commandline arguments; though several other convenience commands are provided for common actions.

COMMANDS

list

Prints a list of each configured perl binary and the detected version.

All configured versions are printed; the selected versions are prefixed by an asterisk.

$ eachperl --since 5.31 list
  perl5.30.0: /usr/bin/perl5.30.0 (v5.30.0)
* bleadperl: /home/user/bin/bleadperl (v5.32.0)

exec

The default command. Invokes each perl binary with the given arguments.

Afterwards a table of exit codes is printed, to summarize the run in case the output was long and scrolled away.

$ eachperl exec -E 'say $]'

  --- perl5.30.0 --- 
5.030000

  --- bleadperl --- 
5.032000

----------
perl5.30.0          : 0
bleadperl           : 0

The word exec is optional if the commandline otherwise begins with a hyphenated option name - which it usually does for short one-line scripts with -M or -E

$ eachperl -E 'say 1+2'

$ eachperl -MConfig -E 'say $Config{nvsize}'

install

A convenient wrapper for installing a module using CPAN.

$ eachperl install A::CPAN::Module

When the module name is exactly . this command is an alias for install-local.

install-local

Install the distribution in the current working directory by directly invoking the build script.

This command implies the --no-system-perl option.

test

A convenient wrapper for testing a module using CPAN.

$ eachperl test A::CPAN::Module

When the module name is exactly . this command is an alias for test-local.

test-local

Install the distribution in the current working directory by directly invoking the build script.

build-then-perl

Builds and tests the distribution in the current working directory, then invokes perl on the remaining commandline. Remember to include -Mblib to instruct the perl to use the newly-built code

$ eachperl build-then-perl -Mblib -MMy::Module -E'say My::Module::func()'

modversion

Prints the version of the named module.

$ eachperl modversion CPAN
perl5.30.0: 2.22
bleadperl: 2.27

modpath

Prints the path to the named module.

$ eachperl modpath CPAN
perl5.30.0: /usr/share/perl/5.30/CPAN.pm
bleadperl: /home/user/perl5/perlbrew/perls/bleadperl/lib/5.32.0/CPAN.pm

uninstall

Attempts to uninstall an installed module, by removing each of the files listed in its .packlist and the packlist itself.

$ eachperl uninstall A::CPAN::Module

OPTIONS

--since VER

Selects only perl versions that are at least as new as the requested version. Any perl binaries older than this will be skipped.

--until VER

Selects only perl versions that are at least as old as the requested version. Any perl binaries newer than this will be skipped.

--ver VER

Selects only this exact perl version.

--devel, --no-devel

Selects only perl versions that are (or are not) development versions (i.e. having an odd-numbered minor version).

--only-if EXPR

An additional perl expression that will be evaluated within the target perl which must additionally return true, to select that perl version. If it returns false then this version will be skipped.

The Config module will already be loaded here; this is useful for expressions like

--only-if '$Config{usethreads}'

--reverse, -r

Reverses the order in which perl versions are invoked.

--stop-on-fail, -s

Stops running after the first failure. Without this option, every version is attempted even if some fail.

Useful when combined with --reverse to test a module to see how far back in earlier perl versions it will support.

--no-system-perl

Deselects the system perl version. The perl version matching the system version (or rather, the version running this script) is skipped.

--no-test

Skip the Build test or make test step when building a local distribution.

CONFIG

The list of available perls is given by a config file, which is found in the user's home directory at $HOME/.eachperlrc. This should be a file in INI format.

In addition, a file of the same name can be placed at the current working directory (presumably the root directory of a project) to override any settings in the main file.

The following keys are recognised

perls

A space-separated list of command names. Each should be searchable using $PATH but need not be specified as a fully-qualified path.

perls = perl5.30.0 bleadperl

Default Commandline Options

Default values for the following commandline options can also be supplied:

since_version = 5.16
until_version = 5.30
only_if = EXPR

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>