Perl: Error “local: not found” from PerlBrew when running older BASH versions or compatible shells (Korn / ksh) SOLVED

If you’re getting the “local: not found” error when running PerlBrew, we have the answer 🙂 The problem is that “local” doesn’t work in older versions of BASH or some other shells you might be using. You simply need to replace “local” with “typeset” in your ~/perl5/perlbrew/etc/bashrc file. Note that whenever you run “perlbrew init” or update the script, you will need to make the change again:

$ perlbrew use perl-5.8.9

A sub-shell is launched with perl-5.8.9 as the activated perl. Run 'exit' to finish it.

/home/wdc1212/.kshrc[13]: .[36]: local: not found [No such file or directory]
/home/wdc1212/.kshrc[13]: .[37]: local: not found [No such file or directory]
$ diff ~/perl5/perlbrew/etc/bashrc.old ~/perl5/perlbrew/etc/bashrc
36,37c36,37
< local code="$($perlbrew_command env $@)"
<     local exit_status="$?"
---
>     typeset code="$($perlbrew_command env $@)"
>     typeset exit_status="$?"
67,68c67,68
< local exit_status
<     local short_option
---
>     typeset exit_status
>     typeset short_option
$ perlbrew use perl-5.8.9<a href="http://perl.org"><img src="http://froebe.net/blog/wp-content/uploads/2010/02/perl-276x300.jpg" alt="perl" width="276" height="300" class="alignright size-medium wp-image-1207" /></a>
$ which perl
~/perl5/perlbrew/perls/perl-5.8.9/bin/perl
Share Button

Run multiple versions of Perl from your home directory

Run multiple versions of Perl from your home directory using Perlbrew!

One thing to know:  Perl won’t compile if you have an encrypted home directory. 🙁 Bug has been fixed but not exactly how and it hasn’t been put into the Ubuntu updates yet.
Thanks goes to Kang-min Liu for creating Perlbrew!!!! 🙂

The recommended way to install perlbrew is to run these statements in your shell:

curl -LO http://xrl.us/perlbrew
    chmod +x perlbrew
    ./perlbrew install

After that, perlbrew installs itself to ~/perl5/perlbrew/bin, and you should follow the instruction on screen to setup your .bashrc or .cshrc to put it in your PATH.

Share Button