X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=misc%2Flink_bibs_to_authorities.pl;h=37596c5024540b7588527a62201e46bf38565379;hb=6b928438ce06f7f7d664766b8206001c57bea817;hp=b35a00e837466a5133b6bfca6d66e5c8c65d8cdc;hpb=ba6c8485ca7afdaaace20d021591ac532de55b3a;p=koha_fer diff --git a/misc/link_bibs_to_authorities.pl b/misc/link_bibs_to_authorities.pl index b35a00e837..37596c5024 100755 --- a/misc/link_bibs_to_authorities.pl +++ b/misc/link_bibs_to_authorities.pl @@ -18,6 +18,7 @@ use Pod::Usage; use Data::Dumper; use Time::HiRes qw/time/; use POSIX qw/strftime ceil/; +use Module::Load::Conditional qw(can_load); sub usage { pod2usage( -verbose => 2 ); @@ -53,13 +54,11 @@ if ( not $result or $want_help ) { my $linker_module = "C4::Linker::" . ( C4::Context->preference("LinkerModule") || 'Default' ); -eval { eval "require $linker_module"; }; -if ($@) { +unless ( can_load( modules => { $linker_module => undef } ) ) { $linker_module = 'C4::Linker::Default'; - eval "require $linker_module"; -} -if ($@) { - die "Unable to load linker module. Aborting."; + unless ( can_load( modules => { $linker_module => undef } ) ) { + die "Unable to load linker module. Aborting."; + } } my $linker = $linker_module->new(