[Catalyst] session in DB example in Catalyst book

Jonathan Rockway jon at jrock.us
Sun May 11 08:13:27 BST 2008


* On Sun, May 11 2008, Andreas Marienborg wrote:
> On May 11, 2008, at 7:14 AM, Andrew wrote:
>
>> And I'm doing everything exactly as the book states except the
>> config change of putting the database path in the YAML file - it's
>> still in the AddressDB.pm file.
>>
>> I looked in the DBIC.pm file which is generating the error message
>> and the method that is causing the error is below:
>>
>> sub session_store_model {
>>    my ($c, $id) = @_;
>>
>>    my $dbic_class = $c->session_store_dbic_class;
>>    $c->model($dbic_class, $id) or die "Couldn't find a model named
>> $dbic_class";
>> }
>>
>> My question is where does $c->session_store_dbic_class come from?
>> Is it a class that I'm suppose to define or is it a class that is
>> suppose to be included in the DBIC module?
>>
>>
> It is a config setting:
>
> http://cpansearch.perl.org/~danieltwc/Catalyst-Plugin-Session-Store-DBIC-0.06/lib/Catalyst/Plugin/Session/Store/DBIC.pm#session_store_dbic_class
>
> - andreas

Actually, it's just a (documented) method:
    
    =head2 session_store_dbic_class
    
    Return the L<DBIx::Class> class name to be passed to C<< $c->model >>.
    Defaults to C<DBIC::Session>.
    
    =cut
    
    sub session_store_dbic_class {
        shift->config->{session}->{dbic_class} || 'DBIC::Session';
    }

As I've mentioned in two other posts, I assume Andrew's problem is that
he didn't configure the plugin as per p.60 of the book.  After reading
this method, I am even more sure that I'm right :)

Regards,
Jonathan Rockway

-- 
print just => another => perl => hacker => if $,=$"



More information about the Catalyst mailing list