summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorKent Fredric <kentnl@gentoo.org>2017-09-15 17:41:08 +1200
committerKent Fredric <kentnl@gentoo.org>2017-09-17 12:06:58 +1200
commit47680c4a8661704aa992710d6e630fbba507ffae (patch)
tree779b282586e877d87ec8209b8b17465a4182abf3 /eclass
parentperl-functions.eclass: Add perl_get_raw_vendorlib (diff)
downloadperl-overlay-47680c4a8661704aa992710d6e630fbba507ffae.tar.gz
perl-overlay-47680c4a8661704aa992710d6e630fbba507ffae.tar.bz2
perl-overlay-47680c4a8661704aa992710d6e630fbba507ffae.zip
perl-functions.eclass: Add perl_get_vendorlib
Diffstat (limited to 'eclass')
-rw-r--r--eclass/perl-functions.eclass23
1 files changed, 23 insertions, 0 deletions
diff --git a/eclass/perl-functions.eclass b/eclass/perl-functions.eclass
index f6ebb1b43..df048549c 100644
--- a/eclass/perl-functions.eclass
+++ b/eclass/perl-functions.eclass
@@ -587,3 +587,26 @@ perl_get_raw_vendorlib() {
print $Config{$ARGV[0]};
exit 0' -- "installvendorlib" || die "Can't extract installvendorlib from Perl Configuration"
}
+
+# @FUNCTION: perl_get_vendorlib
+# @DESCRIPTION:
+# Convenience helper for returning Perls' vendor install root
+# without EPREFIXing.
+#
+# Example:
+# @CODE
+# my_vendorlib="$(perl_get_vendorlib)"
+# @CODE
+
+perl_get_vendorlib() {
+ debug-print-function $FUNCNAME "$@"
+
+ [[ $# -lt 1 ]] || die "${FUNCNAME}: Too many parameters ($#)"
+
+ # Requires perl 5.14 for /r attribute of s///
+ # Just in case somebody out there is stuck in a time warp: upgrade perl first
+ perl -M5.014 -MConfig \
+ -e'exists $Config{$ARGV[0]} || die qq{No such Config key "$ARGV[0]"};
+ print $Config{$ARGV[0]} =~ s{\A\Q$ARGV[1]\E}{}r;
+ exit 0' -- "installvendorlib" "$EPREFIX" || die "Can't extract installvendorlib from Perl Configuration"
+}