summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Fredric <kentnl@gentoo.org>2017-09-15 17:40:11 +1200
committerKent Fredric <kentnl@gentoo.org>2017-09-17 12:06:58 +1200
commitceab43f9475c734a809b873e3c8c818b35a4ddb2 (patch)
treed6be88c0e17923a9621dd2fde6c12d2b80d410fa
parentperl-functions.eclass: Add perl_get_module_version (diff)
downloadperl-overlay-ceab43f9475c734a809b873e3c8c818b35a4ddb2.tar.gz
perl-overlay-ceab43f9475c734a809b873e3c8c818b35a4ddb2.tar.bz2
perl-overlay-ceab43f9475c734a809b873e3c8c818b35a4ddb2.zip
perl-functions.eclass: Add perl_get_raw_vendorlib
-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 8995cebcf..f6ebb1b43 100644
--- a/eclass/perl-functions.eclass
+++ b/eclass/perl-functions.eclass
@@ -564,3 +564,26 @@ perl_get_module_version() {
print ${$stash->{VERSION}};
exit 0; ' "$@"
}
+
+# @FUNCTION: perl_get_raw_vendorlib
+# @DESCRIPTION:
+# Convenience function to optimise for a common case without double-handling
+# variables everywhere.
+#
+# Note: Will include EPREFIX where relevant
+#
+# Example:
+# @CODE
+# my_raw_vendorlib="$(perl_get_raw_vendorlib)"
+# @CODE
+
+perl_get_raw_vendorlib() {
+ debug-print-function $FUNCNAME "$@"
+
+ [[ $# -lt 1 ]] || die "${FUNCNAME}: Too many parameters ($#)"
+
+ perl -MConfig \
+ -e'exists $Config{$ARGV[0]} || die qq{No such Config key "$ARGV[0]"};
+ print $Config{$ARGV[0]};
+ exit 0' -- "installvendorlib" || die "Can't extract installvendorlib from Perl Configuration"
+}