[sf-perl] dynamic use command

Herb Rubin herbr at pfinders.com
Thu Apr 3 18:19:31 PDT 2008


I am trying to do an eval on a use command and if it works, then
do a "use" command for real, but Perl keeps trying to compile it and getting
the error that the module is missing.

I tried putting the module in a scalar and it helped a bit, but I'm missing something:

my $net_smtp_ssl = "Net::SMTP::SSL";

eval {
  use $net_smtp_ssl

if ($@) {
  print "$net_smtp_ssl is missing\n";
} else {
  use $net_smtp_ssl;

Any ideas?


Herb Rubin
Pathfinders Software

More information about the SanFrancisco-pm mailing list