On Mon, 18 Nov 2002 16:12:02 -0600 "James.FitzGibbon" <[EMAIL PROTECTED]> 
wrote:

> 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.

It probably shouldn't go away.  Is there a file Foo/DBIx.pm somewhere?  The
directory Foo/ should be in ./ or in one of the directories mentioned in
@INC.

If you've made sure all the applicable classes already exist, perhaps you
want to use Foo::DBIx->connect() instead.

-- 
Mac :})
** I normally forward private questions to the appropriate mail list. **
Ask Smarter: http://www.tuxedo.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.


Reply via email to