perl-functions.eclass: add perl_get_raw_vendorlib
authorKent Fredric <kentnl@gentoo.org>
Mon, 23 Jan 2017 23:17:42 +0000 (12:17 +1300)
committerKent Fredric <kentnl@gentoo.org>
Fri, 21 Apr 2017 21:30:57 +0000 (09:30 +1200)
eclass/perl-functions.eclass

index be27d7e2509d763d7ca194cde639f301d8712c6b..5073215e0e729d5167a44ac67d2c7257bb22f8ab 100644 (file)
@@ -430,3 +430,21 @@ perl_get_module_version() {
                print ${$stash->{VERSION}};
                exit 0; ' "$@"
 }
+
+# @FUNCTION: perl_get_raw_vendorlib
+# @USAGE: perl_get_raw_vendorlib
+# @DESCRIPTION:
+# Convenience function to optimise for a common case without double-handling
+# variables everywhere.
+#
+# Note: Will include EPREFIX where relevant
+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"
+}
\ No newline at end of file