A more generic tool for this type of function is direnv[http://direnv.net/].
I use direnv for example for setting per-directory Perl installation variables to keep my development environments separate.
I use direnv for example for setting per-directory Perl installation variables to keep my development environments separate.