So it seems the only actually working way is the ugly way of converting the module name to the file name and then requiring that file :
my $module = "CGI";
my $filename = $module;
$filename =~ s!::!/!g;
$filename .= ".pm";
require $filename
or die "$module did not return a true value";
$module->import;
I try to avoid string-eval wherever I can, because I don't like the security implications of it. Of course, it's unlikely that a module name like CGI; qx(rm -rf /)
can be injected, but with my solution that gets avoided completely. Of course, this is most likely total overkill, as in most cases, modules are loaded dynamically upon program startup depending on the OS.