Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users

Simple session snag probably -- "Couldn't find a model named Learn::Session"

 

 

Catalyst users RSS feed   Index | Next | Previous | View Threaded


will.trillich at serensoft

Aug 10, 2013, 2:10 PM

Post #1 of 3 (19 views)
Permalink
Simple session snag probably -- "Couldn't find a model named Learn::Session"

Starting a new app, and winding up with the "Couldn't load class (Learn)
because: Couldn't find a model named Learn::Session" error...

We have two schema:
- Learn::Schema::Auth (users, roles, sessions, etc)
Auth.pm extends 'DBIx::Class::Schema', as expected
- Learn::Schema::DB (real app data here)
Learn.pm extends 'DBIx::Class::Schema', as expected

We are intending to store session info in
Learn::Schema::Auth::Result::Session.

learn.conf includes:

<session>
dbic_class = Learn::Session
</session>

We've done other Catalyst apps with this pattern and they work just fine.
(Blah::Session never really exists on its own, Blah::Model::Blah::Session
doesn't either, but Blah::Schema::DB::Result::Session does and there seems
to be a bit of magic in converting Blah::Session into
Blah::Schema::DB::Result::Session.)

Without <session>dbic_class</> in learn.conf, the error message changes to
"Couldn't find a model named DBIC::Session" as expected.

What's missing here? Something obvious no doubt...



Or, how do we specify "Learn::Schema::DB::Result::Session" for our session
data, using dbic_class in the conf file?


i at h2l

Aug 10, 2013, 10:50 PM

Post #2 of 3 (14 views)
Permalink
Re: Simple session snag probably -- "Couldn't find a model named Learn::Session" [In reply to]

How is your model like?

I suppose you map your schema and model as below:
Learn::Schema::Auth -> Learn::Model::Auth

Then Auth::Session should work.
Use the name of model instead of schema in context of catalyst.

Hope it helps.

On Sun, Aug 11, 2013 at 6:10 AM, will trillich
<will.trillich [at] serensoft> wrote:
> Starting a new app, and winding up with the "Couldn't load class (Learn)
> because: Couldn't find a model named Learn::Session" error...
>
> We have two schema:
> - Learn::Schema::Auth (users, roles, sessions, etc)
> Auth.pm extends 'DBIx::Class::Schema', as expected
> - Learn::Schema::DB (real app data here)
> Learn.pm extends 'DBIx::Class::Schema', as expected
>
> We are intending to store session info in
> Learn::Schema::Auth::Result::Session.
>
> learn.conf includes:
>
> <session>
> dbic_class = Learn::Session
> </session>
>
> We've done other Catalyst apps with this pattern and they work just fine.
> (Blah::Session never really exists on its own, Blah::Model::Blah::Session
> doesn't either, but Blah::Schema::DB::Result::Session does and there seems
> to be a bit of magic in converting Blah::Session into
> Blah::Schema::DB::Result::Session.)
>
> Without <session>dbic_class</> in learn.conf, the error message changes to
> "Couldn't find a model named DBIC::Session" as expected.
>
> What's missing here? Something obvious no doubt...
>
>
>
> Or, how do we specify "Learn::Schema::DB::Result::Session" for our session
> data, using dbic_class in the conf file?
>
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>

_______________________________________________
List: Catalyst [at] lists
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst [at] lists/
Dev site: http://dev.catalyst.perl.org/


will.trillich at serensoft

Aug 11, 2013, 7:13 PM

Post #3 of 3 (10 views)
Permalink
Re: Simple session snag probably -- "Couldn't find a model named Learn::Session" [In reply to]

Ah thanks for the clue-stick :) Hailin --

We had messed up on the CREATE phase in getting the Schema set up, and it
was the two-schema approach that tripped us cuz we weren't paying attention:

script/learn_create.pl model DB DBIC::Schema Learn::Schema::DB
create=static dbi:mysql:learn user pw
script/learn_create.pl model DB DBIC::Schema Learn::Schema::Auth
create=static dbi:mysql:auth user pw

Those are the two commands we had issued to create the model. Whoops! The
first was okay but the second used the exact same second-argument and
shouldn't have.

That is, the second command overwrote the first instance under
Learn::Model::DB. The following fixed it:

script/learn_create.pl model DB DBIC::Schema Learn::Schema::DB
create=static dbi:mysql:learn user pw
script/learn_create.pl model Auth DBIC::Schema Learn::Schema::Auth
create=static dbi:mysql:auth user pw

Changing "DB" to "Auth" in the second arg, and now all is well.

Thanks!



On Sunday, August 11, 2013, Hailin Hu wrote:

> How is your model like?
>
> I suppose you map your schema and model as below:
> Learn::Schema::Auth -> Learn::Model::Auth
>
> Then Auth::Session should work.
> Use the name of model instead of schema in context of catalyst.
>
> Hope it helps.
>
> On Sun, Aug 11, 2013 at 6:10 AM, will trillich
> <will.trillich [at] serensoft> wrote:
> > Starting a new app, and winding up with the "Couldn't load class (Learn)
> > because: Couldn't find a model named Learn::Session" error...
> >
> > We have two schema:
> > - Learn::Schema::Auth (users, roles, sessions, etc)
> > Auth.pm extends 'DBIx::Class::Schema', as expected
> > - Learn::Schema::DB (real app data here)
> > Learn.pm extends 'DBIx::Class::Schema', as expected
> >
> > We are intending to store session info in
> > Learn::Schema::Auth::Result::Session.
> >
> > learn.conf includes:
> >
> > <session>
> > dbic_class = Learn::Session
> > </session>
> >
> > We've done other Catalyst apps with this pattern and they work just fine.
> > (Blah::Session never really exists on its own, Blah::Model::Blah::Session
> > doesn't either, but Blah::Schema::DB::Result::Session does and there
> seems
> > to be a bit of magic in converting Blah::Session into
> > Blah::Schema::DB::Result::Session.)
> >
> > Without <session>dbic_class</> in learn.conf, the error message changes
> to
> > "Couldn't find a model named DBIC::Session" as expected.
> >
> > What's missing here? Something obvious no doubt...
> >
> >
> >
> > Or, how do we specify "Learn::Schema::DB::Result::Session" for our
> session
> > data, using dbic_class in the conf file?
> >
> >
> > _______________________________________________
> > List: Catalyst [at] lists
> > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> > Searchable archive:
> http://www.mail-archive.com/catalyst [at] lists/
> > Dev site: http://dev.catalyst.perl.org/
> >
>
> _______________________________________________
> List: Catalyst [at] lists
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst [at] lists/
> Dev site: http://dev.catalyst.perl.org/
>

Catalyst users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.