[Dbix-class] Class::C3::Componentised bug (was deployment bug with DBIC running from PAR)

Toby Corkindale toby.corkindale at strategicdata.com.au
Wed Jan 28 01:50:42 GMT 2009


Toby Corkindale wrote:
> Toby Corkindale wrote:
>> Hi,
>> I seem to have hit an issue in a specific case:
>> Deployment, to a Postgres DB, when DBIx::Class is running from a PAR 
>> file.
>> The crux is that DBIx::Class::Storage::DBI::Pg has overridden 
>> sqlt_type() to return 'PostgreSQL' rather than the default behaviour 
>> from DBIx::Class::Storage::DBI, which just returns $dbh->{Driver}{Name}.
>> The long form of the name is required when calling out to 
>> SQL::Translator, in order that it finds the correct Producer module.
>>
>> However, when running from a PAR file, for some reason the 
>> Class::C3::Componentised::ensure_class_loaded() method is failing to 
>> find and load DBIx::Class::Storage::DBI::Pg during 
>> DBIx::Class::Schema::Storage::DBI::_populate_dbh() around line 1639 
>> (of version 0.08010).
>>
>> I've verified that the PAR file does actually contain that Pg.pm in 
>> the correct place..
>>
>> but I wondered if anyone else had seen this problem, or had an idea 
>> where I should be looking next?
> 
> Right, I think I've worked out where the problem lies now.
> 
> Class::C3::Componentised's ensure_class_found() method *does not work* 
> in the following situation: When the class exists inside a PAR file 
> which is being accessed via the "use PAR 'archive.par';" method.
> 
> I attach the simplest test case I could create for this.
> 
> To demonstrate, try:
> $ parl foobar.par test_c3.pl
> Foo::Bar found.
> $ ./test_c3_par.pl
> Foo::Bar not found at ./test_c3_par.pl line 7.

I need to stop replying to myself :(
I'd say the problem lies this block of code:

# Look through the @INC path to find the file
     foreach ( @try_first, @INC ) {
         my $full = "$_/$filename";
         next unless -e $full;
         return $UNIX ? $full : $class->_inc_to_local($full);
}

since when using PAR, the first entry in @INC is a coderef, and thus 
this routine tests for '-e "CODE(0xd34db33f)/Foo/Bar.pm"' which, not 
unsurprisingly, fails.

D'Oh.

I'll raise some bugs on RT. Not sure where the blame lies now..



More information about the DBIx-Class mailing list