aboutsummaryrefslogtreecommitdiffstats
path: root/util/with_fallback.pm
diff options
context:
space:
mode:
Diffstat (limited to 'util/with_fallback.pm')
-rw-r--r--util/with_fallback.pm19
1 files changed, 19 insertions, 0 deletions
diff --git a/util/with_fallback.pm b/util/with_fallback.pm
new file mode 100644
index 0000000000..014f355156
--- /dev/null
+++ b/util/with_fallback.pm
@@ -0,0 +1,19 @@
+#! /usr/bin/perl
+
+package with_fallback;
+
+sub import {
+ use File::Basename;
+ use File::Spec::Functions;
+ foreach (@_) {
+ eval "require $_";
+ if ($@) {
+ unshift @INC, catdir(dirname(__FILE__), "..", "external", "perl");
+ my $transfer = "transfer::$_";
+ eval "require $transfer";
+ shift @INC;
+ warn $@ if $@;
+ }
+ }
+}
+1;