Subject: | perlbrew-specific bashrc breaks Linux system upgrade |
Today I upgraded a machine from Ubuntu 13.10 LTS to 14.04 LTS. There were no problems with the upgrade itself whatsoever. However, when I opened the Terminal application to resume Perl 5 development, I immediately encountered problems.
1. I got this error message *immediately* upon opening Terminal:
#####
Can't locate App/perlbrew.pm in @INC (you may need to install the App::perlbrew module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/bin/perlbrew line 6.
BEGIN failed--compilation aborted at /usr/local/bin/perlbrew line 6.
Can't locate App/perlbrew.pm in @INC (you may need to install the App::perlbrew module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/bin/perlbrew line 6.
BEGIN failed--compilation aborted at /usr/local/bin/perlbrew line 6.
#####
2. I found that most of the Unix command-line programs could no longer be located. Examples:
#####
[~] 4 $ vi .bashrc
Command 'vi' is available in '/usr/bin/vi'
The command could not be located because '/usr/bin' is not included in the PATH environment variable.
vi: command not found
[~] 5 $ ls -l .
Command 'ls' is available in '/bin/ls'
The command could not be located because '/bin' is not included in the PATH environment variable.
ls: command not found
#####
Repeated inspection of ~/.bashrc showed me that when I had installed perlbrew on this machine back in March, I had had to add the following line:
#####
source ~/perl5/perlbrew/etc/bashrc
#####
I then inspected this perlbrew-specific bashrc. I believe that the fundamental, system-wide values for the PATH environmental variable -- established (at least in Ubuntu) in /etc/environment -- were *probably* being overwritten by code like this:
#####
PATH_WITHOUT_PERLBREW=$(eval $perlbrew_command display-pristine-path)
if [ -n "$PERLBREW_PATH" ]; then
export PATH=${PERLBREW_PATH}:${PATH_WITHOUT_PERLBREW}
else
export PATH=${PERLBREW_ROOT}/bin:${PATH_WITHOUT_PERLBREW}
fi
unset PATH_WITHOUT_PERLBREW
#####
Once I commented out that 'source' line in my ~/.bashrc file, I regained access to the PATH values from /etc/environment (as well as those I had manually entered in ~/.bashrc via, e.g., "PATH=$HOME/bin/perl:$HOME/bin/shell:$PATH"). So I now have no problem using vi, ls, etc.
But the consequence is that I can no longer use 'perlbrew', since it is that perlbrew-specific bashrc file that establishes 'perlbrew' as a *shell* command. Example:
#####
$ perlbrew list
Can't locate App/perlbrew.pm in @INC (you may need to install the App::perlbrew module) (@INC contains: /etc/perl /usr/local/lib/perl/5.18.2 /usr/local/share/perl/5.18.2 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.18 /usr/share/perl/5.18 /usr/local/lib/site_perl .) at /usr/local/bin/perlbrew line 6.
BEGIN failed--compilation aborted at /usr/local/bin/perlbrew line 6.
#####
I certainly have 'perlbrew' installed; it just can't be located and for some reason throws up that error.
This is a serious design flaw in perlbrew.
Thank you very much.
Jim Keenan