Given this example:

--START--
package Foo::DBIx;
our @ISA = qw(DBI);

package Foo::DBIx::db;
our @ISA = qw(DBI::db);

package Foo::DBIx::st;
our @ISA = qw(DBI::st);

package main;

use DBI;

$dbh = DBI->connect(
    'dbi:Oracle:', 'scott', 'tiger',
    { RootClass => 'Foo::DBIx' }
);
---END---

DBI (v1.30) throws back the following error:

Can't locate Foo/DBIx.pm in @INC (@INC contains:
/home/prod/perl5/lib/5.6.1/aix /home/prod/perl5/lib/5.6.1
/home/prod/perl5/lib/site_perl/5.6.1/aix
/home/prod/perl5/lib/site_perl/5.6.1 /home/prod/perl5/lib/site_perl .) at
/home/prod/perl5/lib/site_perl/5.6.1/aix/DBI.pm line 776.
        ...propagated at /home/prod/perl5/lib/site_perl/5.6.1/aix/DBI.pm
line 780.

The DBI documentation says that this should be a non-fatal error:

  [...] that using an explicit RootClass attribute will make the DBI
  automatically attempt to load a module by that name (and not
  complain if such a module can't be found) [...]

and code in DBI.pm looks like it tries to ignore this type of error:

sub _load_module {
    (my $module = shift) =~ s!::!/!g;
    eval {
        require $module.'.pm';
    };
    return 1 unless $@;
    return 0 if $@ =~ /^\b\@INC\b/;
    die; # propagate $@;
}

But the regex used doesn't match the error thrown back by perl 5.6.1
(the regex itself may be flawed, since '@' !~ /\w/).

If Foo::DBIx is stored in Foo/DBIx.pm, the error isn't thrown.

If the regex is changed to /\@INC\b/, the error also goes away.

Thanks.

--
j.

James FitzGibbon                    
Consultant, Ajilon Services, TTS-3D@CC-950 
[EMAIL PROTECTED]
voice/fax 612-304-6161/3277


Reply via email to