• Stars
    star
    500
  • Rank 88,178 (Top 2 %)
  • Language
    Shell
  • License
    Other
  • Created over 14 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Perl binary manager

NAME

plenv - perl binary manager

SYNOPSIS

plenv help

# list available perl versions
plenv install --list

# install perl5 binary
plenv install 5.16.2 -Dusethreads

# execute command on current perl
plenv exec ack

# change global default perl to 5.16.2
plenv global 5.16.2

# change local perl to 5.14.0
plenv local 5.14.0

# run this command after install cpan module, contains executable script.
plenv rehash

# install cpanm to current perl
plenv install-cpanm

# migrate modules(install all installed modules for 5.8.9 to 5.16.2 environment.)
plenv migrate-modules 5.8.9 5.16.2

# locate a program file in the plenv's path
plenv which cpanm

# display version
plenv --version

DESCRIPTION

Use plenv to pick a Perl version for your application and guarantee that your development environment matches production. Put plenv to work with Carton for painless Perl upgrades and bulletproof deployments.

plenv vs. perlbrew

Like perlbrew, plenv installs perls under your home directory and lets you install modules locally, and allows you to switch to arbitrary perl versions on your shell.

Unlike perlbrew, plenv is implemented in bash, and provides simple shell script wrappers (called "shims") for each perl executable files. It doesn't export any shell functions that switches PATH before running commands.

Unlike perlbrew, plenv allows you to set local perl version per directory, using .perl-version file.

Unlike perlbrew, plenv doesn't provide built-in local::lib integrations, but plenv-contrib implements use and lib commands for a replacement.

INSTALLATION

Compatibility note: plenv is incompatible with perlbrew. Please make sure to fully uninstall perlbrew and remove any references to it from your shell initialization files before installing plenv.

If you're on Mac OS X, consider installing with Homebrew.

Basic GitHub Checkout

This will get you going with the latest version of plenv and make it easy to fork and contribute any changes back upstream.

  1. Check out plenv into ~/.plenv.

    $ git clone https://github.com/tokuhirom/plenv.git ~/.plenv
  2. Add ~/.plenv/bin to your $PATH for access to the plenv command-line utility.

    $ echo 'export PATH="$HOME/.plenv/bin:$PATH"' >> ~/.bash_profile

    Ubuntu note: Modify your ~/.profile instead of ~/.bash_profile.

    Zsh note: Modify your ~/.zshrc file instead of ~/.bash_profile.

  3. Add plenv init to your shell to enable shims and autocompletion.

    $ echo 'eval "$(plenv init -)"' >> ~/.bash_profile

    Same as in previous step, use ~/.profile on Ubuntu.

    Zsh note: Use echo 'eval "$(plenv init - zsh)"' >> ~/.zshrc

  4. Restart your shell as a login shell so the path changes take effect. You can now begin using plenv.

    $ exec $SHELL -l
  5. Install perl-build, which provides a plenv install command that simplifies the process of installing new Perl versions.

    $ git clone https://github.com/tokuhirom/Perl-Build.git ~/.plenv/plugins/perl-build/
    $ plenv install 5.18.0
    

    As an alternative, you can download and compile Perl yourself into ~/.plenv/versions/.

  6. Rebuild the shim executables. You should do this any time you install a new Perl executable (for example, when installing a new Perl version, or when installing a cpanm that provides a command).

    $ plenv rehash
    

Upgrading

If you've installed plenv manually using git, you can upgrade your installation to the cutting-edge version at any time.

$ cd ~/.plenv
$ git pull

To use a specific release of plenv, check out the corresponding tag:

$ cd ~/.plenv
$ git fetch
$ git checkout 2.0.0

Installation Without Git

To install on a system without git, simply download the latest archive and unpack it to ~/.plenv. You will need to repeat this process to upgrade your installation.

$ wget -O plenv.tar.gz https://github.com/tokuhirom/plenv/archive/master.tar.gz
$ mkdir ~/.plenv
$ tar --directory=~/.plenv --strip-components=1 -zxvf plenv.tar.gz

Follow the remaining standard instructions starting at step 2 of Basic GitHub Checkout.

Plugins such as perl-build and plenv-contrib will need to be installed into ~/.plenv/plugins similarly.

$ wget -O perl-build.tar.gz https://github.com/tokuhirom/Perl-Build/archive/master.tar.gz
$ mkdir -p ~/.plenv/plugins/perl-build
$ tar --directory=~/.plenv/plugins/perl-build --strip-components=1 -zxvf perl-build.tar.gz

Homebrew on Mac OS X

You can also install plenv using the Homebrew package manager on Mac OS X.

$ brew update
$ brew install plenv
$ brew install perl-build

To later update these installs, use upgrade instead of install.

Afterwards you'll still need to add eval "$(plenv init -)" to your profile as stated in the caveats. You'll only ever have to do this once.

Neckbeard Configuration

Skip this section unless you must know what every line in your shell profile is doing.

plenv init is the only command that crosses the line of loading extra commands into your shell. Here's what plenv init actually does:

  1. Sets up your shims path. This is the only requirement for plenv to function properly. You can do this by hand by prepending ~/.plenv/shims to your $PATH.

  2. Installs autocompletion. This is entirely optional but pretty useful. Sourcing ~/.plenv/completions/plenv.bash will set that up. There is also a ~/.plenv/completions/plenv.zsh for Zsh users.

  3. Rehashes shims. From time to time you'll need to rebuild your shim files. Doing this automatically makes sure everything is up to date. You can always run plenv rehash manually.

  4. Installs the sh dispatcher. This bit is also optional, but allows plenv and plugins to change variables in your current shell, making commands like plenv shell possible. The sh dispatcher doesn't do anything crazy like override cd or hack your shell prompt, but if for some reason you need plenv to be a real script rather than a shell function, you can safely skip it.

Run plenv init - for yourself to see exactly what happens under the hood.

DEPENDENCIES

* Perl 5.8.1+
* bash
* curl(If you want to use plenv install-cpanm)

FreeBSD users

Mount fdescfs on /dev/fd for using bash. Please add following line to /etc/fstab and restart.

fdesc	/dev/fd		fdescfs		rw	0	0

Command Reference

Like git, the plenv command delegates to subcommands based on its first argument. The most common subcommands are:

plenv local

Sets a local application-specific perl version by writing the version name to a .perl-version file in the current directory. This version overrides the global version, and can be overridden itself by setting the PLENV_VERSION environment variable or with the plenv shell command.

$ plenv local 5.8.2

When run without a version number, plenv local reports the currently configured local version. You can also unset the local version:

$ plenv local --unset

Previous versions of plenv stored local version specifications in a file named .plenv-version. For backwards compatibility, plenv will read a local version specified in a .plenv-version file, but a .perl-version file in the same directory will take precedence.

plenv global

Sets the global version of perl to be used in all shells by writing the version name to the ~/.plenv/version file. This version can be overridden by an application-specific .perl-version file, or by setting the plenv_VERSION environment variable.

$ plenv global 5.8.2

The special version name system tells plenv to use the system perl (detected by searching your $PATH).

When run without a version number, plenv global reports the currently configured global version.

plenv shell

Sets a shell-specific perl version by setting the plenv_VERSION environment variable in your shell. This version overrides application-specific versions and the global version.

$ plenv shell 5.8.2

When run without a version number, plenv shell reports the current value of plenv_VERSION. You can also unset the shell version:

$ plenv shell --unset

Note that you'll need plenv's shell integration enabled (step 3 of the installation instructions) in order to use this command. If you prefer not to use shell integration, you may simply set the PLENV_VERSION variable yourself:

$ export PLENV_VERSION=5.8.2

plenv versions

Lists all perl versions known to plenv, and shows an asterisk next to the currently active version.

$ plenv versions
  system
  5.12.0
  5.14.0
  5.16.1
  5.16.2
  5.17.11
  5.17.7
  5.17.8
  5.18.0
  5.18.0-RC3
  5.18.0-RC4
* 5.19.0 (set by /home/tokuhirom/.plenv/version)
  5.6.2
  5.8.1
  5.8.2
  5.8.3
  5.8.5
  5.8.9

plenv version

Displays the currently active perl version, along with information on how it was set.

$ plenv version
5.19.0 (set by /home/tokuhirom/.plenv/version)

plenv rehash

Installs shims for all perl executables known to plenv (i.e., ~/.plenv/versions/*/bin/*). Run this command after you install a new version of perl, or install a cpanm that provides commands.

$ plenv rehash

plenv which

Displays the full path to the executable that plenv will invoke when you run the given command.

$ plenv which cpanm
/home/tokuhirom/.plenv/versions/5.19.0/bin/cpanm

plenv whence

Lists all perl versions with the given command installed.

$ plenv whence plackup
5.17.11
5.17.7
5.18.0
5.18.0-RC4
5.19.0

FAQ

  • How can I install cpanm?

    Try using the following command:

      % plenv install-cpanm
    

    This command installs cpanm in the current environment.

    If you are installing via a proxy and encounter problems you can set curl arguments via PLENV_INSTALL_CPANM (default is -p):

      % PLENV_INSTALL_CPANM="-v" plenv install-cpanm
    
  • How can I install the modules I used in another Perl environment in my new one?

    You can use the migrate-modules subcommand.

      % plenv migrate-modules 5.8.2 5.16.2
    

    It makes a list of the installed modules in 5.8.2, and installs the newest versions of those modules to the 5.16.2 environment. Note that because the module version won't necessarily be the same between the two versions, there may be changes that affect compatibility, dependencies, or other behaviors your applications depend on.

    You can reuse installed modules from a binary-compatible perl version directly without reinstalling. For example, if you have installed lots of modules in 5.18.1 and install a variant of 5.18.1 with dtrace support, you might not want to migrate all those modules.

      % plenv install 5.18.1 -Dusedtrace --as 5.18.1-dtrace
      % plenv shell 5.18.1-dtrace
      % PERL5LIB=$(PLENV_VERSION=5.18.1 perl -e'print join ":",@INC') perl <command>
    
  • How can I enable -g option without slowing down binary?

    Use following command.

      % plenv install 5.16.2 -DDEBUGGING=-g
    
  • How can I uninstall plenv ?

    Remove plenv configuration lines(plenv init and PATH) from your shell start up configuration. And remove plenv directory as below.

      % rm -rf `plenv root`
    

BUG REPORTING

Plese use github issues: http://github.com/tokuhirom/plenv/.

AUTHOR

Tokuhiro Matsuno <tokuhirom AAJKLFJEF@ GMAIL COM>

SEE ALSO

App::perlbrew provides the same features. But plenv provides project local file: __ .perl-version __.

Most of part was inspired from rbenv.

LICENSE

plenv itself

Copyright (C) Tokuhiro Matsuno

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

rbenv

plenv uses rbenv code

(The MIT license)

Copyright (c) 2013 Sam Stephenson

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

More Repositories

1

Amon

yet another web application framework
Perl
160
star
2

java-handbook

137
star
3

git-xlsx-textconv

Go
132
star
4

akaza

Yet another Japanese IME for IBus/Linux
Rust
127
star
5

Furl

pretty fast http client library for perl5
Perl
103
star
6

Minilla

Authorizing tool for CPAN modules
Perl
97
star
7

Perl-Build

Perl
79
star
8

spring-vue-sample

Java
71
star
9

p6-Crust

PSGI library stack for Perl6
Raku
66
star
10

node-perl

Node perl wrapper
C++
63
star
11

toydi

Java
63
star
12

cpan-outdated

detect outdated CPAN modules
Perl
52
star
13

tora

Tora! Tora! Tora!
Perl
51
star
14

avans

Tiny thin web application framework for Java 8
Java
50
star
15

js-xlsx-demo

JavaScript
50
star
16

SQL-Maker

Perl
47
star
17

jawiki-kana-kanji-dict

Generate SKK/MeCab dictionary from Wikipedia(Japanese edition)
Python
40
star
18

node-mruby

C++
40
star
19

Daiku

Yet another build tool on Perl5
Perl
38
star
20

teng-handbook

Perl
38
star
21

mobirc

IRC Gateway for MobilePhone/iPhone/PC
JavaScript
33
star
22

Test-TCP

Test::TCP for perl
Perl
33
star
23

jsref

JavaScript
33
star
24

re2c-lemon-tutorial

C++
32
star
25

p5-router-simple

simple http router
Perl
32
star
26

tinyorm

Tiny O/R mapper for Java
Java
29
star
27

p5-psgiref

(DEPRECATED)just a prototype!
Perl
28
star
28

Web-Query

Perl
27
star
29

OrePAN

Perl
26
star
30

obsidian-2hop-links-plugin

TypeScript
26
star
31

optimize-perl-doc

how to optimize your perl code?
Perl
26
star
32

frepan

freshness mirror of cpan viewer
JavaScript
25
star
33

strftime-js

JavaScript
25
star
34

menta

General extlib/ for CGI applications.
Perl
25
star
35

PJP

Perl
24
star
36

micro_dispatcher.js

JavaScript
22
star
37

data-model-tutorial

the tutorial documents for Data::Model
Perl
22
star
38

OrePAN2

Perl
22
star
39

hoshipad

JavaScript
22
star
40

FormValidator-Lite

very lite and fast validation library for perl
Perl
21
star
41

go-examples

my Golang examples repo.
Go
21
star
42

THWebViewController

Minimalistic WebViewController
Objective-C
20
star
43

go-hsperfdata

Quite fast jps/jstat
Go
20
star
44

Test-Pretty

Perl
20
star
45

p5-http-server-fast

(DEPRECATED)
C++
18
star
46

p6-HTTP-Server-Tiny

Web application server for Perl6
Perl 6
18
star
47

gearman-stat.psgi

Display gearman stats.
18
star
48

visualwidth-js

JavaScript
18
star
49

Router-Boom

Perl
18
star
50

obsidian-pomodoro-plugin

TypeScript
17
star
51

Archer

Perl
17
star
52

nanobench

Tiny benchmarking framework for Java 7+
Java
17
star
53

nanowww

C++ lightweight, fast, portable HTTP client library
Perl
17
star
54

mouse

Moose minus the antlers
Perl
16
star
55

www-mobilecarrierjp

WWW::MobileCarrierJP
Perl
16
star
56

http-session

http session management library for perl
Perl
16
star
57

HTML-TreeBuilder-LibXML

drop-in-replacement for HTML::TreeBuilder::XPath
Perl
16
star
58

Tiffany

Template-For-All, Generic interface for perl template engines.
Perl
16
star
59

DBIx-Inspector

Perl
16
star
60

w3m

my private repo of w3m
C
15
star
61

File-Zglob

Perl
15
star
62

madeye

simple infrastructure monitoring tool
Perl
15
star
63

Smart-Args

the new args.pm!
Perl
15
star
64

Test-Kantan

Perl
14
star
65

Caroline

Yet another line editing library for Perl5
Perl
14
star
66

p5-net-drizzle

libdrizzle bindings for perl5
C
14
star
67

perl-echo-servers

C
14
star
68

gearman-starter.pl

bootstrap script for gearman worker
Perl
13
star
69

MySQL-BinLog

Perl
13
star
70

obsidian-stopwatch-plugin

TypeScript
13
star
71

MetaCPANExplorer

CSS
13
star
72

node-tcc

C++
13
star
73

HTML-Pictogram-MobileJp

[emoji:1] ใฟใŸใ„ใชใฎใ‚’ๅ‡ฆ็†ใงใใ‚‹ไบบ
Perl
13
star
74

App-watcher

Perl
13
star
75

tinyvalidator

Tiny validation library for Java 8
Java
13
star
76

Text-Markdown-Hoedown

Perl
13
star
77

java-samples

Java
12
star
78

nanotap

yet another tap header library
HTML
12
star
79

App-scan_prereqs_cpanfile

Scan prerequisite modules and generate CPANfile
Perl
12
star
80

MojaMoja

(PoC)yet another sinatra-ish framework built on CPAN modules
Perl
12
star
81

Test-SharedFork

Test::SharedFork
Perl
12
star
82

p5-cgi-emulate-psgi

CGI::Emulate::PSGI
Perl
11
star
83

p5-anyevent-mprpc

MessagePack RPC component for AnyEvent!
Perl
11
star
84

mRuby.pm

Perl
11
star
85

devel-bindpp

Devel::BindPP makes writing perl extension easily
C++
11
star
86

Test-Power

Perl
11
star
87

regexp-trie

Regexp::Trie for Java7
Java
11
star
88

Sub-Retry

Perl
11
star
89

blosxom.psgi

cho45 style blosxom thing for psgi. see http://coderepos.org/share/wiki/BlosxomClones
10
star
90

cgi-extlib-perl

General extlib/ for Perl CGI applications.
Perl
10
star
91

p5-module-install-forc

M::I extension for standalone C program/library
Perl
10
star
92

DBIx-Kohada

Perl
10
star
93

Amon2-Lite

Perl
10
star
94

autolink.js

JavaScript
10
star
95

Module-Spy

Perl
10
star
96

p6-WebSocket

Perl 6
10
star
97

Harriet

Perl
10
star
98

Cache-KyotoTycoon

KyotoTycoon client library for Perl5
Perl
10
star
99

mindcheese

Editable mindmap library written in TypeScript
TypeScript
10
star
100

Perl-Lexer

C
10
star