Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add per-project perl version #49

Closed
wants to merge 1 commit into from

Conversation

Projects
None yet
6 participants
@fcuny
Copy link
Contributor

fcuny commented Apr 3, 2011

Hi

I've started to work on a simple feature (inspired from rvm) where you can stick a .perlbrewrc file a directory. Simple usage:

cd ~/code/App-Perlbrew
echo "perlbrew switch perl-5.12.3" > .perlbrewrc

then next time you go to ~/code/App-Perlbrew, perl is set to version 5.12.3

There is a lot of things to do before I can consider this "done", but before spending time on this, is this a feature you would consider ?

thanks!

add per-project perl version
Signed-off-by: franck cuny <franck@lumberjaph.net>
@doy

This comment has been minimized.

Copy link
Contributor

doy commented Apr 3, 2011

I already do this - https://github.com/doy/conf/blob/master/bashrc#L323 and yes, it is very helpful. +1 to the idea.

@gugod

This comment has been minimized.

Copy link
Owner

gugod commented Apr 5, 2011

I definitely consider this to be a very useful feature.

The way rvm does it, is to define a "cd" bash function, and I doubt if there's any other ways to do so, such that it can be compatible with rvm.

And I have no idea how to provide a solid csh/tcsh support for this feature ponder, really need some shell-fu here.

@hoelzro

This comment has been minimized.

Copy link
Contributor

hoelzro commented May 23, 2011

+1 from me as well. I've had problems with RVM clobbering my personal cd override in the past though, so would it be possible to detect if cd is overriden and deliver a message or something? I'm thinking something like this:

function perlbrew_cd
{
     # maybe call __rvm_project_rvmrc here if rvm is defined?
     ...
}
type=$(type -t cd)
if [[ $type == 'function' ]]; then
   typeset -f cd | grep -q perlbrew_cd
   if [[ $? -ne 0 ]]; fi
     echo "HEY!  Perlbrew has noticed that you override the 'cd' builtin, but it wants in on the directory-changing action!  Please call perlbrew_cd from your cd override!"
   fi
else
   function cd
   {
      builtin cd "$@"
      perlbrew_cd
   }
fi
@leedo

This comment has been minimized.

Copy link

leedo commented Nov 16, 2011

@gudgod: overriding cd can be avoided by using the approach taken by rbenv. It creates shim binaries that use the correct ruby version.

@gugod

This comment has been minimized.

Copy link
Owner

gugod commented Nov 18, 2011

@leedo Can you provide some generated shims for reference ? I do not use rbenv myself but I would like to take a glance how they do it.

@leedo

This comment has been minimized.

Copy link

leedo commented Nov 18, 2011

All the shims are the same:

#!/usr/bin/env bash
set -e
exec rbenv exec "${0##*/}" "$@"

I should note that you have to run rbenv rehash after any new binaries are installed in the selected ruby for the shims to be generated. (see https://github.com/sstephenson/rbenv/blob/master/libexec/rbenv-rehash)

@telemachus

This comment has been minimized.

Copy link

telemachus commented Nov 18, 2011

No idea about csh or tcsh, but zsh provides chpwd_functions (which rvm makes use of) for this sort of thing.

The shims approach of rbenv is a big change, I think. That is, it would mean reworking all of how Perlbrew operates. There's some discussion in these posts:

@gugod

This comment has been minimized.

Copy link
Owner

gugod commented Dec 30, 2011

I recommend using smartcd https://github.com/cxreg/smartcd for the purpose, it is an external solution but it requires very minimum setup.

@gugod gugod closed this Dec 30, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.