with_fallback.pm 696 B

123456789101112131415161718192021222324252627
  1. # Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
  2. #
  3. # Licensed under the OpenSSL license (the "License"). You may not use
  4. # this file except in compliance with the License. You can obtain a copy
  5. # in the file LICENSE in the source distribution or at
  6. # https://www.openssl.org/source/license.html
  7. package with_fallback;
  8. sub import {
  9. shift;
  10. use File::Basename;
  11. use File::Spec::Functions;
  12. foreach (@_) {
  13. eval "use $_";
  14. if ($@) {
  15. unshift @INC, catdir(dirname(__FILE__),
  16. "..", "..", "external", "perl");
  17. my $transfer = "transfer::$_";
  18. eval "use $transfer";
  19. shift @INC;
  20. warn $@ if $@;
  21. }
  22. }
  23. }
  24. 1;