I am using Module::Load to load a module dynamically. But I am not able to invoke a method defined in the module. Here is what I am doing
my $module = load("Module");
$module->function();
I am getting the following error:
Can't call method "function" without a package or object reference
What is wrong in the above code?
The load function doesn't have a specified return value. I think you're looking for this:
my $module = 'Module';
load($module);
$module->function();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With