X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=misc%2Flink_bibs_to_authorities.pl;h=37596c5024540b7588527a62201e46bf38565379;hb=9c5e40e4923179bf0b2b630d3e09797dc4c1fdb0;hp=b35a00e837466a5133b6bfca6d66e5c8c65d8cdc;hpb=413a1e1e61b343db47b9b6fdecf3d981d87013ef;p=koha.git 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(