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 );
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(
my $linker = shift;
my $biblionumber = shift;
- my $bib = GetMarcBiblio($biblionumber);
+ my $bib = GetMarcBiblio({ biblionumber => $biblionumber });
unless ( defined $bib ) {
print
"\nCould not retrieve bib $biblionumber from the database - record is corrupt.\n";