[Catalyst] Conflict between C::TraitFor::Model::DBIC::Schema::Caching and C::P::I18N::DBI

Octavian Râşniţă orasnita at gmail.com
Wed Dec 2 17:56:46 GMT 2009


Hello,

I've installed Catalyst::TraitFor::Model::DBIC::Schema::Caching and it seems 
to work fine, but it conflicts with Catalyst::Plugin::I18N::DBI.

I made the following settings in order to be able to use C::TraitFor::...

'Model::DB' => {
  traits => ['Caching'],
  schema_class => 'BRK::Schema',
  connect_info => {
    dsn => 'dbi:mysql:database=brk',
    user => 'root',
    password => "",
    quote_char => '`',
    name_sep => '.',
  },
},

'Plugin::Cache' => {
  backend => {
    class => 'Cache::FileCache',
    cache_root => '__path_to(temp,cache)__',
  },
},

Each time I access a page that contains a string which was not translated, 
instead of replacing the key with "? $key" and inserting that key in the 
database, MyApp just prints the key and it doesn't insert it into the DB.
And the follow error message is printed to STDERR:

[error] Failed within fail_with(): Can't use string ("BRK") as a HASH ref 
while "strict refs" in use at E:/perl510/site/lib/Class/Accessor/Fast.pm 
line 10.

This error is printed in the module
Catalyst::Plugin::I18N::DBI
at line 255.

If I comment the line
  traits => ['Caching'],
in the Model::DB settings above, then Catalyst::Plugin::I18N::DBI works fine 
again.

I've seen that the program seems to end in Catalyst::Plugin::I18N::DBI at 
line 240, and this line is:

                        my $res = $c->model($cfg->{lex_class})->search({ key 
=> $key, lang => $lang, lex => $default_lex })->first;

I've seen that the program ends there no matter what search I made using 
DBIC.

That line is enclosed in a eval {} block, but no matter it is enclosed in 
eval {} or not, the program doesn't break, although when it is enclosed in 
eval it fails and sets that error in $@.

If I take that line outside the eval {} block and put a $c->log->error line 
above it and another $c->log->error line below it, the error put above it 
prints to the error log, but the line below it it doesn't.
(And it is the same if I do this in the eval {} block. That's why I said 
that the program seems to end on that line.)

I don't know what's Catalyst::TraitFor::Model::DBIC::Schema::Caching doing 
that it doesn't allow C::P::I18N::DBI work correctly, but I have no idea how 
to solve this issue.

Help!

Thank you.

Octavian




More information about the Catalyst mailing list