Giter Club home page Giter Club logo

plenv's Introduction

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.

plenv's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

plenv's Issues

Installation instructions out of date?

I've had "try switching to plenv" on my to-do for a while. This morning, I tried!

I cloned into .plenv, set up bash profile entries, and so on.

rjbs@proto:~$ plenv install
-bash: plenv: command not found

Hm.

rjbs@proto:~$ ls .plenv/bin -l
total 0
lrwxrwxrwx 1 rjbs rjbs 16 Nov  1 11:59 plenv -> ../libexec/plenv
rjbs@proto:~$ ls .plenv/libexec/ -l
total 12
-rwxr-xr-x 1 rjbs rjbs 1376 Nov  1 12:06 plenv-install-cpanm
-rwxr-xr-x 1 rjbs rjbs  360 Nov  1 12:06 plenv-list-modules
-rwxr-xr-x 1 rjbs rjbs 1223 Nov  1 12:06 plenv-migrate-modules

git blame shows that plenv got deleted in cfa6f64. Now it's "rbenv-based." I need to run make to get plenv set up. Okay! Clearly I need to install rbenv, so I did.

rjbs@proto:~/.plenv$ make
bash ./author/copy-from-rbenv.sh
cp: cannot stat `/home/rjbs/.rbenv/libexec/*': No such file or directory
cp: cannot stat `/home/rjbs/.rbenv/completions/*': No such file or directory
Can't open completions/*: No such file or directory, <> line 142.
grep: plugins/perl-build/author: Is a directory
grep: plugins/perl-build/bin: Is a directory
grep: plugins/perl-build/lib: Is a directory
grep: plugins/perl-build/script: Is a directory
grep: plugins/perl-build/t: Is a directory
grep: plugins/perl-build/xt: Is a directory
grep: completions/*: No such file or directory
Can't open libexec/plenv-init: No such file or directory.
Can't open libexec/plenv---version: No such file or directory.
Can't open libexec/plenv-help: No such file or directory.

I guess I need to set up my rbenv first… but I don't use rbenv. I guess I should, but I don't, and I don't know what I have to do next. Running rbenv doesn't show any "setup" command or anything.

If nothing else, the README needs to be updated.

PERL5OPT breaks plenv

> PERL5OPT=-MDevel::Cover make test
Can't locate Devel/Cover.pm in @INC (@INC contains: /Library/Perl/5.12/darwin-thread-multi-2level /Library/Perl/5.12 /Network/Library/Perl/5.12/darwin-thread-multi-2level /Network/Library/Perl/5.12 /Library/Perl/Updates/5.12.3 /System/Library/Perl/5.12/darwin-thread-multi-2level /System/Library/Perl/5.12 /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level /System/Library/Perl/Extras/5.12 .).

This is because plenv is a perl script and accepts PERL5OPT no matter what. If you specify -M with modules you don't have with your system perl, it breaks.

Ultimately plenv should be written in bash (no joking), but i guess there should be a workaround to hook these PERL_* env variables before executing plenv perl script.

Stop creating cpanm shim

plenv install-cpanm creates a shim that calls rehash automatically and that is causing me pains.

There should be a mechanism for cpanm to automatically call plenv rehash only when there's a successful module installation.

Update #69 fails curl via proxy

Update #69 fails for our site.

Verified by hand when running curl -v -p -L http://cpanmin.us/

* Establish HTTP proxy tunnel to cpanmin.us:80
> CONNECT cpanmin.us:80 HTTP/1.1
> Host: cpanmin.us:80
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.14.3.0 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 403 Tunnel or SSL Forbidden
< Date: Wed, 01 Oct 2014 09:20:32 GMT
< Connection: close
< Via: 1.1 WCG1
< Cache-Control: no-store
< Content-Type: text/html
< Content-Language: en
< Content-Length: 312
<
* Received HTTP code 403 from proxy after CONNECT
* Closing connection #0
curl: (56) Received HTTP code 403 from proxy after CONNECT

Writing your own plugins?

Sorry to open it as an issue – it probably doesn't belong here, but since github doesn't have a messaging feature anymore, this was the only way I could communicate with you.

One of my pet projects is rakudobrew (http://github.com/tadzik/rakudobrew), and when I thought of finally writing it correctly for it to be actually useful to anybody, I wondered if it'd be possible to implement it as a plenv plugin. I see that 'plenv build' is implemented as a plugin, but its usage seems to be hardcoded in plenv itself. So I wonder, is there a way to write a plugin for plenv? How would I do that?

How do you pass -I flag to perl-build or change the include paths list

$ plenv install 5.19.3
Fails on my x86_64 mageia with gcc 4.7.2

Reason being:
Your C compiler "cc" doesn't seem to support stdarg or varargs!

The files (stdarg.h and varargs.h) does exist in:
/usr/lib/gcc/x86_64-mageia-linux-gnu/4.7.2/include

And gcc does include them internally:
$ touch foo.c && gcc --verbose -c foo.c 2>&1 |grep -A3 '#include <'

include <...> search starts here:

/usr/lib/gcc/x86_64-mageia-linux-gnu/4.7.2/include
/usr/local/include
/usr/include

But perl-build does not look in that directory:
Directories to use for library searches?
[/usr/local/lib /lib/../lib64 /usr/lib/../lib64 /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64]

How can I change that list

Unable to install perl

I am on Mac OSX 10.5.8 and installed plenv using brew. However, the install is throwing error for any version of perl i try to install. Below is the one for perl-5.10.1

Install 5.10.1 to /Users/sid/.plenv/versions/5.10.1
Fetching 5.10.1 as /var/folders/az/azc7iGwYH0SthirIT36L8++++TI/-Tmp-/Lod61oKN53/perl-5.10.1.tar.bz2
rm -f config.sh Policy.sh
/usr/bin/perl -Mlib=/usr/local/Cellar/plenv/1.1.0/bin/../share/plenv//lib/perl5/ /usr/local/Cellar/plenv/1.1.0/bin/../share/plenv/bin/patchperl
Can't locate IPC/Cmd.pm in @INC (@INC contains: /usr/local/Cellar/plenv/1.1.0/bin/../share/plenv//lib/perl5/ /Library/Perl/Updates/5.8.8/darwin-thread-multi-2level 
/Library/Perl/Updates/5.8.8 /System/Library/Perl/5.8.8/darwin-thread-multi-2level 
/System/Library/Perl/5.8.8 /Library/Perl/5.8.8/darwin-thread-multi-2level /Library/Perl/5.8.8 /Library/Perl /Network/Library/Perl/5.8.8/darwin-thread-multi-2level 
/Network/Library/Perl/5.8.8 /Network/Library/Perl
 /System/Library/Perl/Extras/5.8.8/darwin-thread-multi-2level 
/System/Library/Perl/Extras/5.8.8 /Library/Perl/5.8.6 /Library/Perl/5.8.1 .) at 
/usr/local/Cellar/plenv/1.1.0/bin/../share/plenv//lib/perl5//Devel/PatchPerl.pm line 13.

Any idea why it's happening and how to fix it ?

Bad file descriptor when trying to tell me "no such command"

$ plenv -v
plenv 2.0.1
$ plenv -ape
/usr/local/bin/plenv: line 85: 3: Bad file descriptor

Line 85 is echo "plenv: no such command \'$command'" >&3, but that file descriptor seems to not be open (yet?). Is it a typo, should it be >&2 to output to STDERR?

Does install-cpanm not like Module::Build not being core?

I just tried to build Perl 5.21.8 and it seemed to work okay

plenv install 5.21.8
plenv rehash
plenv global 5.21.8

But installing cpanm failed

$ plenv install-cpanm
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   314    0   314    0     0    883      0 --:--:-- --:--:-- --:--:--   884
100  294k  100  294k    0     0   486k      0 --:--:-- --:--:-- --:--:--  486k
ExtUtils::MakeMaker is up to date. (7.04)
--> Working on App::cpanminus
Fetching http://www.cpan.org/authors/id/M/MI/MIYAGAWA/App-cpanminus-1.7024.tar.gz ... OK
Configuring App-cpanminus-1.7024 ... OK
==> Found dependencies: Module::Build
--> Working on Module::Build
Fetching http://www.cpan.org/authors/id/L/LE/LEONT/Module-Build-0.4211.tar.gz ... OK
Configuring Module-Build-0.4211 ... OK
Building and testing Module-Build-0.4211 ... OK
Successfully installed Module-Build-0.4211
! Installing the dependencies failed: Module 'Module::Build' is not installed
! Bailing out the installation for App-cpanminus-1.7024.
1 distribution installed

Module::Build was a core module, but no longer is

$ perl -MModule::CoreList -E 'say Module::CoreList->removed_from("Module::Build")'
5.021

Do we need to do something else to install cpanm now? I'm having trouble working out if this a problem with Perl 5.21.8, App::cpanminus, Module::Build or plenv.

Install without Git

Need some instructions in the Install section on how to install without Git.

Inconsistency between `which` and `exec`

Not a big deal, but which seems to locate commands outside perl's bin, while exec fails to. It looks like an inconsistent behavior - compare with rbenv.

➜  ~  rbenv which ls
rbenv: ls: command not found
➜  ~  rbenv exec ls
rbenv: ls: command not found
➜  ~  plenv which ls
/bin/ls
➜  ~  plenv exec ls
[plenv] There is no ls in /Users/miyagawa/.plenv/versions/5.16.3/bin.(determined by /Users/miyagawa/.plenv/version)

How would you initialize an Apache app with plenv?

I was thinking of setting up the apache user on RHEL5 with plenv so that it would be aware of .perl-version files within different webapp directories. By default, the apache user doesn't have a login. How would you set this up without changing that?

For Bugzilla, which is what I'm working on now, I started by creating a system account for user 'bugzilla'. Now I'm setting up plenv for that user as instructed here. Next I'll need to figure out a maintainable way to ensure that Bugzilla is always run as bugzilla user and therefore picks up ".perl-version" under "./bugzilla/".

plenv rehash is so slow

plenv rehash is so slow (takes about 10 seconds) as I have many plenv versions installed. rbenv rehash is about 300ms.

It annoys the hell out of me because plenv install-cpanm adds a rehash hook for every invocation for cpanm, even for --info usage etc.

Turns out there're lots of shims like xsubpp5.20.1, and that is causing the extra step.

➜  .plenv  ls shims/ | grep  5. | wc -l
     792
➜  .plenv  ls shims/ | grep  -v 5. | wc -l
     320

These executables are completely useless because plenv takes care of switching versions.

I'm sure if plenv stops symlinking these executables plenv rehash is much faster.

Implement plenv -v|--version

There's no way to know which plenv i'm running.

✗ plenv -v
Unknown command _v. at /usr/local/bin/plenv line 27.

minimum version

Hi is there a way to specify a minimum version in .perl-version file.

for example >= 5.2X.X?

$PATH pollution

When running a shim such as perl, $PATH is polluted with ~/.plenv/libexec and plenv plugins' bin/ directories.

$ perl -E '(my $p = $ENV{"PATH"}) =~ s!(:$ENV{HOME}/bin:).*!$1...!; $p =~ s!$ENV{HOME}\/!\$HOME/!g;say $p'
$HOME/.plenv/versions/5.16.3/bin:$HOME/.plenv/libexec:$HOME/.plenv/plugins/perl-build/bin:$HOME/bin:...

plenv shell " no such command " error in Ubuntu.

$ plenv shell
plenv: no such command `shell'

This error can be fixed by addling a condition to change the command_path for plenv shell command. ( which should be plenv-sh-shell )

Example code in plenv file:

79 command_path="$(command -v "plenv-$command" || true)"
80 if [ -z "$command_path" ]; then

installing PerlPowerTools will make the system horsed

If you install PerlPowerTools http://search.cpan.org/~bdfoy/PerlPowerTools/ it installs bunch of binaries including head and cat into perl's bin, which makes plenv create shims for it ... and then any command invoked by plenv will recurse into itself (because they call head and cat etc.?) and fork bombs the shell until it takes down the system.

In my particular case, plenv rehash triggered the whole breakage, but i guess any commands will do, once head/cat are symlinked.

I have no time to investigate further but this actually happened to me, and there should be a safe guard in plenv to prevent it from happening.

Why is .perl-version checked in this repository?

Just curious, why is .perl-version checked in the repository?

I chdir'ed to ~/.plenv to use the git install of plenv, and after that, every command I run from there uses 5.8.9 and i was confused.

I think it's better to exclude that file from git repo (and add to .gitignore) but let me know if there's a reason to add this in the repository.

`plenv install 5.16.2` fails

plenv version 1.4.2 installed with Homebrew on OS X Mountain Lion.

$ plenv install 5.16.2
Creating /var/folders/dk/v_l97l413879hb_lbcyg4cgw0000gn/T/perl-build-20130218-13541834483(building directory)
Install 5.16.2 to /Users/ivacklin/.plenv/versions/5.16.2
Fetching 5.16.2 as /var/folders/dk/v_l97l413879hb_lbcyg4cgw0000gn/T/JztUT2jdj7/perl-5.16.2.tar.bz2
Downloaded http://search.cpan.org/CPAN/authors/id/R/RJ/RJBS/perl-5.16.2.tar.bz2 to /var/folders/dk/v_l97l413879hb_lbcyg4cgw0000gn/T/JztUT2jdj7/perl-5.16.2.tar.bz2.
rm -f config.sh Policy.sh
/usr/bin/perl -Mlib=/usr/local/Cellar/plenv/1.4.2/bin/../share/plenv//lib/perl5/ /usr/local/Cellar/plenv/1.4.2/bin/../share/plenv/bin/patchperl
version version 0.87 required--this is only version 0.82 at /usr/local/Cellar/plenv/1.4.2/bin/../share/plenv//lib/perl5//Module/Metadata.pm line 20.
BEGIN failed--compilation aborted at /usr/local/Cellar/plenv/1.4.2/bin/../share/plenv//lib/perl5//Module/Metadata.pm line 20.
Compilation failed in require at /usr/local/Cellar/plenv/1.4.2/bin/../share/plenv//lib/perl5//Module/Load/Conditional.pm line 14.
BEGIN failed--compilation aborted at /usr/local/Cellar/plenv/1.4.2/bin/../share/plenv//lib/perl5//Module/Load/Conditional.pm line 14.
Compilation failed in require at /usr/local/Cellar/plenv/1.4.2/bin/../share/plenv//lib/perl5//IPC/Cmd.pm line 50.
BEGIN failed--compilation aborted at /usr/local/Cellar/plenv/1.4.2/bin/../share/plenv//lib/perl5//IPC/Cmd.pm line 50.
Compilation failed in require at /usr/local/Cellar/plenv/1.4.2/bin/../share/plenv//lib/perl5//Devel/PatchPerl.pm line 13.
BEGIN failed--compilation aborted at /usr/local/Cellar/plenv/1.4.2/bin/../share/plenv//lib/perl5//Devel/PatchPerl.pm line 13.
Compilation failed in require at /usr/local/Cellar/plenv/1.4.2/bin/../share/plenv/bin/patchperl line 12.
BEGIN failed--compilation aborted at /usr/local/Cellar/plenv/1.4.2/bin/../share/plenv/bin/patchperl line 12.
Installation failure: /usr/bin/perl -Mlib=/usr/local/Cellar/plenv/1.4.2/bin/../share/plenv//lib/perl5/ /usr/local/Cellar/plenv/1.4.2/bin/../share/plenv/bin/patchperl at /usr/local/Cellar/plenv/1.4.2/bin/../share/plenv/lib/perl5/Perl/Build.pm line 208.

install list shows raw html

When running
plenv install -l

it appears that we just get a truncated HTML listing.
It worked when I tried later.
On OSX (Yosemite) brewed plenv 2.1.0

A short fragment of the output...

Available versions:
5.6.0.tar.gz">perl-5.6.0.tar.gz</a></td><td align="right">23-Mar-2000 07:06</td><td align="right">5.2M</td><td>&nbsp;</td></tr><tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]"></td><td><a href="perl-5.6.0.tar.gz.md5.txt">perl-5.6.0.tar.gz.md5.txt</a></td><td align="right">17-Jun-2011 18:14</td><td align="right">32</td><td>&nbsp;</td></tr><tr><td valign="top"><img src="/icons/text.gif" alt="[TXT]"></td

Port to Windows

This would probably require plenv being rewritten; bash is not very Windows-compatible, even with Cygwin / MinGW's best efforts.

Please fix typo

failed test xt/xt/01_podspell.t.
Following is patch.

diff --git a/lib/App/plenv/install.pod b/lib/App/plenv/install.pod
index 89a9ec4..4f171ea 100644
--- a/lib/App/plenv/install.pod
+++ b/lib/App/plenv/install.pod
@@ -54,6 +54,6 @@ If you specify the version number, plenv fetches tar ball for the version from C

 =item /path/to/perl.tar.gz

-When you specify the path to tar ball, plenv extract it and intall.
+When you specify the path to tar ball, plenv extract it and install.

 =back
diff --git a/xt/01_podspell.t b/xt/01_podspell.t
index d68af35..b9edfec 100644
--- a/xt/01_podspell.t
+++ b/xt/01_podspell.t
@@ -59,3 +59,10 @@ Miyashita
 mysqldiff
 mmm
 JSON
+CPAN
+Axxx
+Dxxx
+Uxxx
+init
+plenv's
+cpanm

why deprecated

I am curious why you gave up on this dist? Did you find something better? Did it not fit the Perl way? Perlbrew does some of what Python's virtualenv does, but only some of it.

(XS) Modules installed by Carton doesn't play nice with Plenv

plenv global 5.23.0
plenv shell 5.23.0
plenv rehash

plenv versions
system

  • 5.23.0 (set by PLENV_VERSION environment variable)

carton install
....

carton exec perl app.pl
Can't locate Data/Structure/Util.pm in @inc (you may need to install the Data::Structure::Util module) (@inc contains: /home/user/project/local/lib/perl5 /home/user/.plenv/versions/5.23.0/lib/perl5/site_perl/5.23.0/x86_64-linux-thread-multi /home/user/.plenv/versions/5.23.0/lib/perl5/site_perl/5.23.0 /home/user/.plenv/versions/5.23.0/lib/perl5/5.23.0/x86_64-linux-thread-multi /home/user/.plenv/versions/5.23.0/lib/perl5/5.23.0 .)

Although the module exists in my local lib, it isn't in my @inc.

ls /home/user/project/local/lib/perl5/x86_64-linux-gnu-thread-multi/Data/Structure/Util.pm
/home/user/project/local/lib/perl5/x86_64-linux-gnu-thread-multi/Data/Structure/Util.pm

carton exec perl -e 'print "$_\n" for @inc'
/home/user/project/local/lib/perl5
/home/user/.plenv/versions/5.23.0/lib/perl5/site_perl/5.23.0/x86_64-linux-thread-multi
/home/user/.plenv/versions/5.23.0/lib/perl5/site_perl/5.23.0
/home/user/.plenv/versions/5.23.0/lib/perl5/5.23.0/x86_64-linux-thread-multi
/home/user/.plenv/versions/5.23.0/lib/perl5/5.23.0

So I thought add the extra lib dir to @inc

carton exec perl -I /home/user/project/local/lib/perl5/x86_64-linux-gnu-thread-multi app.pl
perl: symbol lookup error: /home/user/project/local/lib/perl5/x86_64-linux-gnu-thread-multi/auto/Data/Structure/Util/Util.so: undefined symbol: Perl_xs_apiversion_bootcheck

Using Perl installed by the system solves the problem

plenv global system
plenv shell system
plenv rehash

carton exec perl -e 'print "$_\n" for @inc'
/home/user/project/local/lib/perl5/x86_64-linux-gnu-thread-multi
/home/user/project/local/lib/perl5
/etc/perl
/usr/local/lib/perl/5.14.2 /usr/local/share/perl/5.14.2
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.14
/usr/share/perl/5.14
/usr/local/lib/site_perl

Now my application runs fine. So it seems that modules installed by Carton are compiled against my system perl instead of the one installed by plenv in my home directory.

Migrating modules shows inconsistent result

Hi,
I just installed 5.20.1 via plenv. I was using a development version previously via perlbrew. After successful install I did a plenv migrate-modules system 5.20.1. This seemed to install my modules, as a list-modules command shows me several modules. Particularly the Template one. I am trying to run that, and it is not found in my @inc.

Any ideas?

shebang in perl script ignored when called from shell script

I've been using plenv for a while with no problems. But after converting some cron jobs to plenv on OS X and Solaris, I started seeing some errors like this:

/path/to/foo.pl: line 2: use: command not found

Here is the behavior I have observed: when running a shell script that executes a perl script, the shebang in the perl script is ignored, and the content of the perl script is being evaluated as shell script.

I was able to prevent the error using the 'eval exec perl ...' magic from the perlrun manpage. But that is unfortunately not a great across-the-board solution for the target environment.

I was able to write a test case that illustrates the problem, see here:

https://gist.github.com/wu/8119651

How to run tests?

test/shim.t uses ext/test-simple-bash/lib that is not in the repository.
It would be useful to put a test/README that would say how to fetch the ext directory.

plenv shouldn't be just for $USER

It would be great if plenv would officially support an application directory configuration by setting PLENV_HOME to the application directory.

The application would still have to run plenv init in its shell environment, of course.

plenv overrides 'convert' command

convert is an ImageMagick app installed in /bin/convert, but when plenv is installed, I get this error:

$ convert
plenv: convert: command not found

The `convert' command exists in these Perl versions:
  5.18.4

I'm running Perl 5.20.2, Fedora 21.

install-cpanm doesn't seem to install cpanm "binary"?

When I run 'plenv install-cpanm' it downloads something and then says: "App::cpanminus is up to date. (1.7004)"

However, when I attempt "cpanm Carton" it finds no 'cpanm' in my $PATH. Shouldn't "plenv install-cpanm" install the 'cpanm' "binary" in ~/.plenv/bin ??

let me uninstall my stupid `-j8` version

I run commands without reading the help. It's just what I do, apparently. I ran this:

$ plenv install -j8 5.18.1

This installed 5.18.1 as -j8. I realize that the -j8 was dumb. I just figured it would do what I thought. That's not the problem, it was totally my fault.

First, smaller problem:

Why did that work? It doesn't match the usage of plenv install.

rjbs@d6proto:~$ plenv install

Summary: Install a Perl version using the perl-build plugin

Usage: plenv install [-v|--verbose] <version>
       plenv install [-v|--verbose] /path/to/definition
       plenv install -l|--list

  -l/--list        List all available versions
  -v/--verbose     Verbose mode: print compilation status to stdout
  --as=<NAME>      Install the definition as <NAME>
  --test           Run test cases

Second, larger problem:

I can't uninstall my screw-up!!

rjbs@d6proto:~$ plenv versions
  system
* 5.18.0 (set by /home/rjbs/.plenv/version)
  -j8
rjbs@d6proto:~$ plenv uninstall -j8
Usage: plenv uninstall [-f] <version>

   -f  Attempt to remove the specified version without prompting
       for confirmation. If the version does not exist, do not
       display an error message.

See `plenv versions` for a complete list of installed versions.

rjbs@d6proto:~$ plenv uninstall -- -j8
Usage: plenv uninstall [-f] <version>

   -f  Attempt to remove the specified version without prompting
       for confirmation. If the version does not exist, do not
       display an error message.

See `plenv versions` for a complete list of installed versions.

I'll just use rm. :)

plenv install docs wrong?

For detailed information on installing Perl versions with
perl-build, including a list of environment variables for adjusting
compilation, see: https://github.com/tokuhirom/perl-build#usage

But https://github.com/tokuhirom/perl-build#usage doesn't actually have a usage section and I don't see environment variables mentioned anywhere.

What I'm looking for is how to pass my own args to Configure in plenv install.

Thanks!

Install documentation improvements

Maybe I can help on this at the hackathon, but the installation document is a little unclear which method is the best (CPAN, homebrew or git).

I think many people are already using perlbrew and consider switching to plenv. In that case, installing plenv with cpanm under homebrew is quite dangerous and could lead to a confusing situation. I actually have done that initially (i.e. cpanm App::plenv under homebrew perl), and when I tried to stop using perlbrew, then there's no plenv to use anymore.

I think there's a big caveat under the CPAN section that you have to use the system perl to install plenv, like actually using /usr/bin/perl

curl -L cpanmin.us | /usr/bin/perl - --sudo App::plenv

since otherwise there's a chicken-egg problem (I think?).

Also: There should probably be an entry for "why is plenv rehash necessary after cpanm installation" in the FAQ.

Shebang for plenv

How to use it within CGI?

Or what is the shebang like "#!/usr/bin/env perl" in perlbrew?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.