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