'Set PATH and PERL5LIB to include the extension and
any other perl extensions it depends on,
assuming they were installed with INSTALL_BASE defined.'

def setup_dependent_environment(self, spack_env, run_env, dependent_spec):

    perl_lib_dirs = []
    perl_bin_dirs = []
    for d in dependent_spec.traverse(deptype=('build', 'run'), deptype_query='run'):
        if d.package.extends(self.spec):
            perl_lib_dirs.append(d.prefix.lib.perl5)
            perl_bin_dirs.append(d.prefix.bin)
    perl_bin_path = ':'.join(perl_bin_dirs)
    perl_lib_path = ':'.join(perl_lib_dirs)
    spack_env.prepend_path('PATH', perl_bin_path)
    spack_env.prepend_path('PERL5LIB', perl_lib_path)
    run_env.prepend_path('PATH', perl_bin_path)
    run_env.prepend_path('PERL5LIB', perl_lib_path)
