4

I installed perlbrew on Linux backtrack on my virtual machine. and I have perl 5.10.1 installed on my backtrack. but when I write perlbrew command in the terminal it shows the following message: perlbrew: command not found

What is wrong with my system?

Sharukh
  • 43
  • 1
  • 3
  • @ruakh, `perlbrew` is a shell function, not an executable. – ikegami Dec 29 '12 at 17:59
  • @ikegami, actually it's both. The shell function handles the environment variable changing, but the executable prints out what the environment should look like. – cjm Dec 29 '12 at 18:05
  • @cjm, Yeah, but it's the shell function that's executed by the user and would result in that error. It's not relevant that there should also exist an executable with the same name. – ikegami Dec 29 '12 at 18:09

2 Answers2

13

When you installed perlbrew, you were instructed to add something like

source ~/perl5/perlbrew/etc/bashrc

to your shell startup script (.bashrc). It appears that you did not do this, or that you did not restart your shell after doing this.

ikegami
  • 367,544
  • 15
  • 269
  • 518
  • when I copy code in ~/perl5/perlbrew/etc/bashrc and paste it into a ~/.bash_profile and restarted the virtual machine, it worked. It was instructed but I didn't pay much attention. – Sharukh Dec 29 '12 at 18:07
  • 3
    Don't copy the code; that will break upgrades. Use `source ~/perl5/perlbrew/etc/bashrc` instead. – ikegami Dec 29 '12 at 18:10
  • thanks.perhaps I misunderstood the instructions. It is the instructions: – Sharukh Dec 29 '12 at 18:15
  • perlbrew is installed: ~/perl5/perlbrew/bin/perlbrew perlbrew root (~/perl5/perlbrew) is initialized. Append the following piece of code to the end of your ~/.bash_profile and start a new shell, perlbrew should be up and fully functional from there: source ~/perl5/perlbrew/etc/bashrc Simply run `perlbrew` for usage details. – Sharukh Dec 29 '12 at 18:16
  • "The following piece of code" is `source ~/perl5/perlbrew/etc/bashrc`, not the contents of some file. – ikegami Dec 29 '12 at 18:28
  • You didn't miss anything. It's apparently a step they forgot to mention on the official instructions = / (http://perlbrew.pl/) – Andy Corman Mar 31 '16 at 22:33
2

The standard sudo apt install perlbrew on a fresh Ubuntu18 install appears to be borken (and Ubuntu20 too if my memory isn't malfunctioning). And has been so for some time. I couldn't get it to work even if I appended source ~/perl5/perlbrew/etc/bashrc to ~/.bash_profile and/or ~/.bashrc and started a new bash. And also did perlbrew init.

What eventually worked for me is curl -L https://install.perlbrew.pl | bash taken from https://perlbrew.pl/ After this which perlbrew shows the correct /home/me/perl5/perlbrew/bin/perlbrew instead of /usr/bin/perlbrew. And now I can see the whole list of available perl5 versions with perlbrew available.

Kjetil S.
  • 3,468
  • 20
  • 22