with_fallback.pm 687 B

12345678910111213141516171819202122232425
  1. # Copyright 2016 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. use File::Basename;
  10. use File::Spec::Functions;
  11. foreach (@_) {
  12. eval "require $_";
  13. if ($@) {
  14. unshift @INC, catdir(dirname(__FILE__),
  15. "..", "..", "external", "perl");
  16. my $transfer = "transfer::$_";
  17. eval "require $transfer";
  18. shift @INC;
  19. warn $@ if $@;
  20. }
  21. }
  22. }
  23. 1;