in reply to Using arbitrary packages
will do it but it will do it at runtime, whereas a genuine use will do it at compile time. If you doeval "use $foo"; die $@ if $@ # die with error message if it failed
it will happen at compile time, you just need to be careful that $foo has a value at compile time.BEGIN { my $foo = get_a_module_name(); eval "use $foo"; die $@ if $@ }
|
|---|