Paul Griffin wrote:
> I'm running Win XP with Perl 5.8.8.
> 
> If I try and run the following code :
> 
> use DBI;
> my %drivers = DBI->installed_drivers();
> foreach (keys( %drivers)) {
>     print "$_ uses $drivers{$_}\n";
> }
> 
> Nothing is returned.  Yet if I use :
> 
> my @drivers = DBI->available_drivers();
> 
> I get a list of drivers that I can then access with :
> 
> @dataSources = DBI->data_sources($_);
> 
> Am I using DBI->installed_drivers() incorrectly?

DBI->installed_drivers returns only the drivers that are actually loaded
into the current process.  Installed in this case means "installed into
memory."

This code will load all the drivers (generally not a good thing) and
then list them with installed_drivers():

  use DBI;
  eval { DBI->install_driver($_) }
    foreach DBI->available_drivers;
  my %drivers = DBI->installed_drivers;
  print "$_: $drivers{$_}\n" foreach sort keys %drivers;

Philip

Reply via email to