perlbrew Documentation

repository·develop·Indexed 20 days ago

https://github.com/gugod/app-perlbrew

A tool to automate the building and installation of multiple isolated Perl environments within a user's home directory. It allows developers to switch between different Perl versions without requiring root or sudo privileges.

Tokens
922
Snippets
4
Records
5
Agent score
23%

What's inside perlbrew

  1. Manage Perl installations with perlbrew

    develop

    perlbrew allows you to install, list, and switch between multiple isolated Perl environments in your $HOME directory. This avoids the need for sudo when installing CPAN modules.

    Common Workflow:

    1. Check available versions: See what versions are available to install.
    2. Install a version: Download and build a specific Perl version.
    3. List installed versions: See which Perls you have already built.
    4. Switch versions: Set a specific version as the default for your shell.
    5. Use a version temporarily: Use a specific version only in the current shell session without changing the default.
    6. Turn off perlbrew: Revert to using the system Perl.
    # See what is available
    perlbrew available
    
    # Install specific versions
    perlbrew install 5.32.1
    perlbrew install perl-5.28.3
    
    # List installed Perls
    perlbrew list
    
    # Switch to a version and set it as default
    perlbrew switch perl-5.32.1
    
    # Temporarily use a version in the current shell
    perlbrew use perl-5.28.3
    
    # Turn off perlbrew and go back to system perl
    perlbrew off
    
    # Turn it back on
    perlbrew switch perl-5.32.1
    perlbrew use perl-5.32.1
  2. Install perlbrew

    develop

    You can install perlbrew using the official installer script or via CPAN.

    Using the installer script (Recommended): Use curl or fetch to run the installer. By default, perlbrew installs to ~/perl5/perlbrew.

    Using CPAN: You can install it using your system Perl via cpan App::perlbrew. Note that if you are upgrading, you should run perlbrew off first to ensure you are using the system Perl and not a perlbrew-managed version.

    Customizing Installation Location: To install perlbrew to a directory other than ~/perl5/perlbrew, set the PERLBREW_ROOT environment variable before running the installer.

    # Standard installation
    curl -L https://install.perlbrew.pl | bash
    
    # Installation with fetch (FreeBSD)
    fetch -o- https://install.perlbrew.pl | sh
    
    # Custom installation root
    export PERLBREW_ROOT=/opt/perl5
    curl -L https://install.perlbrew.pl | bash
    
    # Installation via CPAN
    cpan App::perlbrew
  3. Configure perlbrew environment variables

    develop

    perlbrew respects several environment variables for custom configurations:

    • PERLBREW_ROOT: Defines the directory where all installed Perls, libraries, and documentation are stored. Default is ~/perl5/perlbrew.
    • PERLBREW_SYSTEM_PERL: Used if you need to install perlbrew using a system Perl located in a non-standard path (not /usr/bin/perl or /usr/local/bin/perl).
  4. Execute commands with all perlbrew-managed Perls

    develop

    Use perlbrew exec to run a command through the lens of all Perl installations managed by perlbrew. This is useful for testing scripts or commands across your brewed environments.

    perlbrew exec -- perl -E 'say $]