optional 'require'

Jacqui Caren jacqui.caren at ntlworld.com
Wed Dec 21 16:11:52 GMT 2005


Dirk Koopman wrote:
> I have tried various styles of: eval { require DBI; }; and eval "require
> DBI"; so far without adequate success.

What is the problem with the require?

If you said eval { use ... } I could understand why the eval "fails".

Hint: available_drivers() method after an import.

i.e.
  eval "require DBI";
  unless ($@) {
   import DBI;
   print join(" ",DBI->available_drivers())."\n";
  } else {
   print "No DBI\n";
  }

With two local perls...

jacqui at PAULNJ sendmail]$ /usr/bin/perl b
ExampleP InterBase Sponge mysql
[jacqui at PAULNJ sendmail]$ /usr/local/p584i/bin/perl b
CSV DBM ExampleP File InterBase Pg Proxy Sponge
[jacqui at PAULNJ sendmail]$




More information about the london.pm mailing list