# pperlbrew pperlbrew manages parallel installations of Perl 5, PetaPerl (`pperl`) and PerlOnJava (`jperl`). It reuses the commands, build options and installation layout of App-perlbrew 1.03. It keeps its own root at `~/perl5/pperlbrew` and shell settings at `~/.pperlbrew`. ## Install on Linux without Perl Run the installer as your normal user. ```sh curl -fsSL https://perl.petamem.com/downloads/pperlbrew/install.sh | sh ``` The installer contains the manager and its Perl modules. It reads PetaPerl’s SHA256SUMS at installation time, selects the newest plain `static-min` for the machine’s Linux architecture, verifies the binary’s SHA-256, and checks its target-specific Config before activating it. The installer needs a shell, curl, base64, tar with gzip, sha256sum and basic Linux utilities. Open a new shell, or run the activation line printed by the installer. With the default root in sh, bash or zsh that line is `. "$HOME/perl5/pperlbrew/etc/bashrc"`. The installed launcher can also be used immediately by its absolute path. Set `PPERLBREW_NO_PROFILE=1` to manage shell startup yourself. Set `PPERLBREW_ROOT` to an absolute path for a different install location. ## Install with an existing Perl The CPAN distribution conflicts with every version of `App::perlbrew` visible to the installing Perl. Remove App-perlbrew from that Perl or use another Perl for the CPAN installation. The Linux bootstrap supports an explicit side-by-side installation with `--force`. Install `App::pperlbrew` with your usual CPAN client, then initialize and activate it in your shell. ```sh cpanm App::pperlbrew pperlbrew init . "$HOME/perl5/pperlbrew/etc/bashrc" ``` The CPAN executable runs with the Perl that installed it. `init` links the executable into the manager root and writes the shell startup files. `self-install` also initializes a CPAN installation. Upgrade it using the same CPAN client. The Linux installer supplies a private static pperl for machines without Perl. ## Moving from perlbrew The Linux installer stops before downloading the runtime or changing files if it detects perlbrew. Record the builds you need with `perlbrew list`, uninstall perlbrew with the method you used to install it, remove its shell activation line, and start a fresh login shell. To keep perlbrew during a transition, explicitly request a side-by-side installation. Use separate roots and shell settings for each manager. ```sh curl -fsSL https://perl.petamem.com/downloads/pperlbrew/install.sh | sh -s -- --force # With a downloaded installer sh install.sh --force ``` The override installs pperlbrew and leaves perlbrew, its interpreters and its settings in place. Use `pperlbrew self-upgrade --force` for subsequent bootstrap upgrades while perlbrew is present. Use pperlbrew as your sole active Perl manager, even if you only manage Perl 5. Both shell integrations change which `perl` runs, and a saved `switch` can reapply that selection when you open a terminal. Keep only the pperlbrew activation line in your shell startup file. Install the Perl 5 versions and build options you need under pperlbrew's own root. Check `command -v perl` after `pperlbrew switch NAME`. pperlbrew warns on stderr before each command while it can detect perlbrew, including an inactive installation on `PATH` or in its configured or default root. Removing the startup line resolves the shell conflict. The presence warning continues while the old installation is discoverable. ## Manage interpreters ```sh pperlbrew available pperl # Catalog example for Linux x86-64 pperlbrew install pperl-0.6.25 pperlbrew install pperl-0.6.25 --from ./my-pperl --as experiment pperlbrew install 5.42.0 pperlbrew install -n jperl-5.44.1 pperlbrew list pperlbrew use experiment perl -v pperlbrew switch pperl-0.6.25 pperlbrew exec --with jperl-5.44.1,perl-5.42.0,pperl-0.6.25 perl -e 'print "$^X\n"' pperlbrew off ``` `use` selects an interpreter for the current shell. `switch` also saves the selection for future shells. A selected PetaPerl or PerlOnJava installation exposes both its native name and `perl`. The manager keeps running on its original Perl after a switch, uninstall of a managed interpreter, or `off`. `available [perl|pperl|jperl]` lists releases. Perl 5 uses the upstream perlbrew source-build machinery and needs a C build toolchain. PetaPerl uses checksummed Linux binaries or a local executable supplied with `--from`. PerlOnJava builds a tagged source archive using Bash, Gradle and a JDK (24 or later for the listed releases). 5.44.1 ships its Gradle wrapper. 5.44.0 needs `gradle` on PATH. The build downloads Java dependencies. The `-n` flag skips upstream interpreter tests. Each alternative interpreter must execute a Perl expression before pperlbrew installs it. Run `pperlbrew help install` for more options. For a separate, selectable ARM64 interpreter, install a copy of the release executable with the following command. The older 0.6.25 ARM64 builds fail file and directory checks and have been removed from the download catalog. ```sh pperlbrew install pperl-0.6.27 --from ./pperl-0.6.27-aarch64-static-dbi-shell pperlbrew use pperl-0.6.27 ``` ### PerlOnJava versions and options ```sh pperlbrew install jperl-5.44.0 --as java-old pperlbrew install jperl-5.44.1 --as java-new pperlbrew use java-new perl -MConfig -e 'print "$Config{useithreads} $Config{ivsize}\n"' JPERL_THREAD_MODE=platform jperl script.pl jperl --interpreter script.pl ``` PerlOnJava 5.44.1 reports ithreads enabled and an eight-byte integer. Its release build has no configure switch for disabling ithreads or selecting four-byte integers. Virtual versus platform threads and compiled versus interpreted execution are runtime choices. `--as` names an installation. Perl 5 configure flags such as `--thread` and `--64int` apply to Perl 5 source builds. [Thread modes](https://github.com/fglock/PerlOnJava/blob/v5.44.1/docs/reference/threads.md) and [command-line options](https://github.com/fglock/PerlOnJava/blob/v5.44.1/docs/reference/cli-options.md). ## Shell startup and everyday use The bootstrap prints an activation line and normally adds it to your shell startup file. With CPAN, run `pperlbrew init` and add the appropriate line yourself. These examples use the default root. | Shell | Activation | | --- | --- | | sh, Bash, zsh | `. "$HOME/perl5/pperlbrew/etc/bashrc"` | | fish | `source "$HOME/perl5/pperlbrew/etc/pperlbrew.fish"` | | csh, tcsh | `source "$HOME/perl5/pperlbrew/etc/cshrc"` | Use `pperlbrew use` to see the current selection and `command -v perl` in sh or Bash to see which executable the shell finds. After `pperlbrew off`, the shell searches the rest of your PATH for Perl. On a machine bootstrapped without a system Perl this can leave `perl` unavailable. The manager still works. Use `pperlbrew switch-off` to clear the saved selection for future shells too. `--as` creates a separate installation. An alias gives an existing installation another name. For instance, after installing `java-new` above, run `pperlbrew alias create java-new java-default`. Remove that name with `pperlbrew alias delete java-default`. To remove an interpreter, first switch to another one or run `pperlbrew switch-off`, then run `pperlbrew uninstall java-new`. Review the directories in the confirmation prompt, which include associated local module libraries. For the full local manual, run `pperlbrew help`. For one command, run e.g. `pperlbrew help exec`. With a CPAN installation you can also read `perldoc pperlbrew`. ## Upgrades and troubleshooting - **Upgrade the manager.** For a bootstrap installation, use `pperlbrew self-upgrade`. With local release files, run `sh dist/install.sh` from the checkout. With CPAN, install the newer App-pperlbrew distribution through the same CPAN client, then run `pperlbrew init` and reload the activation file. - **Upgrade an interpreter.** Install a new PetaPerl or PerlOnJava release alongside the old one, test it with `pperlbrew use NAME`, then make it the default with `pperlbrew switch NAME`. For a managed Perl 5 installation, `pperlbrew upgrade-perl` upgrades the active installation in place within its release series. - **The shell cannot find pperlbrew or switching has no effect.** Source the activation file in the current shell. For the bootstrap, `"$HOME/perl5/pperlbrew/bin/pperlbrew" version` checks the default installation directly. For a custom installation, substitute your `PPERLBREW_ROOT`. With CPAN, ensure the installing Perl's executable directory is on PATH before running `pperlbrew init`. - **A release is missing.** Use `pperlbrew available pperl` or `pperlbrew available jperl` to see this manager's catalog. PetaPerl entries depend on CPU architecture. A missing bootstrap for an architecture and a missing managed interpreter are separate release files. - **A checksum fails.** For a cached PetaPerl or PerlOnJava release, run `pperlbrew download --force NAME` to fetch and verify it again. For a bootstrap checksum failure, check that the release server has the binary matching SHA256SUMS and retry the installer. - **A jperl build fails.** Check `java -version` and `JAVA_HOME` against the JDK requirement above. The Gradle wrapper in jperl 5.44.1 rejects Java 27 with “Unsupported class file major version 71”. Select JDK 25 with `JAVA_HOME`. For jperl 5.44.0, check `gradle --version` as well. The build needs network access to Gradle dependencies. ## Development tests From the checkout, run the following with the same Perl for dependencies and tests. ```sh make test-deps make test make coverage make test-bootstrap STATIC_PPERL=/absolute/path/to/static-pperl make test-families STATIC_PPERL=/absolute/path/to/native-static-pperl ``` `test-deps` uses cpanminus to install test and coverage modules in `.dev/`. The TAP suite exercises the manager offline. Install git, tar and curl to exercise all fixtures. Coverage measures first-party Perl modules and writes `cover_db/coverage.html`. The family test downloads and builds Perl 5 and two PerlOnJava releases, installs PetaPerl, and runs each installation. It needs a C build toolchain, Gradle and a supported JDK. It uses `-n` to skip the upstream interpreter suites. ## Build the CPAN release ```sh make cpan-dist make test-cpan ``` The first command builds `build/cpan/App-pperlbrew-VERSION.tar.gz` from the allowlist in `cpan/MANIFEST`. MakeMaker generates `META.json` and `META.yml`. The archive contains the command, modules, shell integration, release catalog, documentation, MIT license and offline tests. CPAN resolves the declared Perl dependencies. The second command rebuilds the archive, unpacks it, runs its tests, installs into a temporary prefix and exercises the installed CLI and shell. For a new release, update `$VERSION` in `lib/App/pperlbrew.pm` and `Changes`. Use the PETAMEM date version `0.YYMMDDN`, where N starts at zero each day. For publication, the maintainer can upload the tested tarball through PAUSE or run `cpan-upload --user PETAMEM "$(cat build/cpan/tarball)"` with CPAN::Uploader. These make targets run locally. ## Build the Linux bootstrap release Build the installer from a checkout and upload the generated `dist/install.sh` to `https://perl.petamem.com/downloads/pperlbrew/install.sh`. This is the only file to deploy for pperlbrew. ```sh tools/make-release dist ``` PetaPerl serves the runtime binaries and `SHA256SUMS` under `https://perl.petamem.com/downloads/`. Each install or self-upgrade looks for `pperl-VERSION-ARCH-static-min` and compares version numbers numerically. A missing, incompatible or damaged minimum stops installation. The known-broken 0.6.25 ARM64 and RISC-V minimum builds are rejected by digest. Verified runtime downloads are cached by SHA-256 under `PPERLBREW_ROOT/libexec/runtimes/`. To test against a private mirror, set `PPERLBREW_RUNTIME_URL` to the directory containing its `SHA256SUMS` and binaries. Run `make test-bootstrap STATIC_PPERL=/path/to/compatible-static-pperl` for the isolated no-Perl installation test. It uses a local HTTP index fixture. For ARM64, set `BOOTSTRAP_BUSYBOX` to a static AArch64 BusyBox with QEMU binfmt enabled. ### What the minimum runtime needs The downloaded interpreter supplies its own target-specific `Config`. The installer embeds the manager, its help text, the Perl release map (`CPAN::Perl::Releases`) and support for named module libraries (`local::lib`). Installation makes no CPAN requests. The release builder uses `Pod::Text` to render the help. | Former module dependency | How the Linux manager handles it | |---|---| | FindBin, Cwd, File::Spec | The launcher locates its own files. The manager resolves Linux paths with `readlink`. | | File::Copy, File::Path, File::Temp | Linux utilities copy and move files, create private staging directories and remove them. Final replacements use Perl's atomic `rename`. | | Digest::SHA | The installer and the manager use `sha256sum` to verify downloads. | | JSON::PP, JSON::PP::Boolean, Encode, Math::BigInt, Math::BigFloat | Perl release lookup loads a bundled, UTF-8 JSON reader. The catalog needs strings, ordinary numbers and boolean flags. | | Pod::Usage | The manager reads the help embedded in the installer. | | IO::Handle, Scalar::Util | The manager captures child output using Perl's built-in pipes and filehandles. The capture library is only needed by the test suite. | ## License and attribution pperlbrew is MIT-licensed. The adapted management code comes from Kang-min Liu's App-perlbrew, revision `5ca72848e906f59489343d4e395c9e8a2a582354`. Its copyright notice is in `LICENSE`. The modules in `vendor/` come from that revision's standalone distribution and retain their authors' license notices. PetaPerl and the managed interpreter distributions retain their own licenses. The release metadata reader incorporates decoder code from David Oswald's JSON::Tiny 0.58, derived from Mojo::JSON, under the Artistic License 2.0. [License](LICENSES/JSON-Tiny)