Skip to content

Instantly share code, notes, and snippets.

@allardhoeve
Last active December 28, 2015 07:29
Show Gist options
  • Save allardhoeve/7464298 to your computer and use it in GitHub Desktop.
Save allardhoeve/7464298 to your computer and use it in GitHub Desktop.
Populate PERL5LIB when you have a directory full of Perl package repo's.

Usage

  1. put your libbyte-star-perl packages into ~/devel/byte/perl/;
  2. put this script in the same directory;
  3. then add the bash snippet to your ~/.bashrc: export PERL5LIB=$(~/devel/byte/perl/perl5lib)

I get autosplit errors

When you get Cannot find blaap/auto/Byte/Blaap/autosplit.ix errors, go to the library it is complaining about and run perl Makefile.PL && make.

#!/bin/bash
set -u
set -e
perl5lib=""
if [[ -L $0 ]]; then
realname=$(readlink $0)
else
realname=$0
fi
dir=$(realpath $(dirname $realname))
for lib in $(find "$dir" -maxdepth 1 -mindepth 1 -type d -name 'lib*-perl'); do
perl5lib="$perl5lib:$lib/lib/:$lib/blib/lib/"
done
echo $perl5lib
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment