This post details how to go about installing perlbrew on a Fedora 20 Linux system for a user whose default shell is in the ksh family, specifically mksh
, which is the shell I use.
The instructions in each section can be used separately if you are just a Fedora user or just a (m)ksh user.
Installing Perlbrew on Fedora 20
If you try to install Perlbrew using the instructions on its website, Fedora barfs. Fortunately, the workaround you need is detailed in this Github issue. (Hint: read the whole thread and then do what wumpus says.)
Using Perlbrew with ksh or mksh
The perlbrew bashrc
file uses a few “bashisms” (unnecessarily, I think, but it is a “bash” rc after all). I managed to hack them out and, instead of sourcing perlbrew’s default bashrc
file, I now source a kshrc
built by applying the patch below.
It’s working well for me so far under mksh
, but feel free to leave a comment if it doesn’t work for you and I’ll try to help.
Happy Perlbrewing!
--- bashrc 2014-12-30 12:49:14.110446784 -0500 +++ kshrc 2014-12-30 13:15:58.750454519 -0500 @@ -1,6 +1,5 @@ export PERLBREW_BASHRC_VERSION=0.72 - __perlbrew_reinit() { if [[ ! -d "$PERLBREW_HOME" ]]; then mkdir -p "$PERLBREW_HOME" @@ -13,7 +12,9 @@ } __perlbrew_purify () { - local path patharray outsep + path= + patharray= + outsep= if [[ -n "$BASH_VERSION" ]]; then IFS=: read -ra patharray <<< "$1" fi @@ -30,13 +31,13 @@ } __perlbrew_set_path () { - export MANPATH=$PERLBREW_MANPATH${PERLBREW_MANPATH:+:}$(__perlbrew_purify "$(manpath)") - export PATH=${PERLBREW_PATH:-$PERLBREW_ROOT/bin}:$(__perlbrew_purify "$PATH") + export MANPATH=$PERLBREW_MANPATH:$MANPATH + export PATH=${PERLBREW_PATH:-$PERLBREW_ROOT/bin}:$PATH hash -r } __perlbrew_set_env() { - local code + code= code="$($perlbrew_command env $@)" || return $? eval "$code" } @@ -64,8 +65,8 @@ } perlbrew () { - local exit_status - local short_option + exit_status= + short_option= export SHELL if [[ $1 == -* ]]; then
(Image courtesy Japanexperterna.se under Creative Commons License.)