For my perl jobs i always use perlbrew for setting ip perl environments. Because i am working on multiple projects in multiple perl environment i need so switch the perl envonriments contantly. To see which perl version i am using currently, i made a small extension for the zsh shell.
I am using the theme powerlevel9k and added the following lines to my .zshrc:
1POWERLEVEL9K_CUSTOM_PERL_VERSION="perl_version_print"
2POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(context dir rbenv vcs)
3POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(status history time custom_perl_version)
4
5perl_version_print () {
6 echo $(env perl -e 'print $^V')
7}
The first three lines set environment variables specific for the powerlevel9k theme. In the first line i defined a new function keyword (perl_version_print) and use it in line 3 to be displayed on the right side in the shell. The last lines define the function that is called to determin the current perl version.
Here is screenshot what it will look like: