2
0

with_fallback.pm 350 B

12345678910111213141516171819
  1. #! /usr/bin/perl
  2. package with_fallback;
  3. sub import {
  4. use File::Basename;
  5. use File::Spec::Functions;
  6. foreach (@_) {
  7. eval "require $_";
  8. if ($@) {
  9. unshift @INC, catdir(dirname(__FILE__), "..", "external", "perl");
  10. my $transfer = "transfer::$_";
  11. eval "require $transfer";
  12. shift @INC;
  13. warn $@ if $@;
  14. }
  15. }
  16. }
  17. 1;