The package name is not mymodule.pm, so of course the import() call fails. Convert the file path to a package name:
(my $package_name = $file_path) =~ s{/}{::}g; $package_name =~ s/\.pm//;
Then you can call import() on it.
In reply to Re: import() when require-d module name is variable
by chromatic
in thread import() when require-d module name is variable
by akujbida
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |