Re: [Catalyst] session in DB example in Catalyst book

2008-05-11 Thread Jonathan Rockway
* 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 class name to be passed to C<< $c->model >>.
Defaults to C.

=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 $,=$"

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


Re: [Catalyst] session in DB example in Catalyst book

2008-05-11 Thread Jonathan Rockway
* On Sun, May 11 2008, 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?

This is just an internal method that implements the details of storing
session data with DBIx::Class.  (If you want the details, read the
Catalyst::Plugin::Session code, and see how it delegates to
Catalyst::Plugin::Session::Store and Catalyst::Plugin::Session::State.
Catalyst::Plugin::Session::Store::DBIC is the DBIC.pm that you are
referring to; its methods become $c->whatever when loaded into your app.
All Catalyst plugins currently work this way; all of their methods
become $c-> or YourApp-> methods as soon as you load them in the "use
Catalyst" line.)



I have a feeling that you are not following the book.  In Chapter 4, I
never call the database model "DBIC", I call it "AddressDB".  On page
60, I show the necessary configuration:

  AddressBook->config->(session => {
  dbic_class => 'AddressDB::Session',
  flash_to_stash => 1,
  });

You'll note that the word "DBIC" never appears in the program text, and
hence shouldn't be in error messages.  Are you sure that your
configuration is setup like the book.  Are you sure something in your
YAML file isn't overwriting this?

(If you look in the code bundle, you can find this in
chapter7-AddressBook/lib/AddressBook.pm.  Chapter 7 is just an extension
of Chapter 4, which for some reason isn't included in the tarball.  I
will probably update that in the next few days.  It makes sense to me,
but not anyone else :)

FWIW, later on in the book I call the model DBIC for the other
applications; I like this style better and I wrote those parts more
recently :)

Anyway, after you've checked that "DBIC" doesn't appear in your
configuration, let me know if it still doesn't work.

Regards,
Jonathan Rockway

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

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


Re: [Catalyst] session in DB example in Catalyst book

2008-05-11 Thread Andreas Marienborg


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



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


Re: [Catalyst] session in DB example in Catalyst book

2008-05-10 Thread Andrew
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?



--- On Sat, 5/10/08, Jonathan Rockway <[EMAIL PROTECTED]> wrote:

> From: Jonathan Rockway <[EMAIL PROTECTED]>
> Subject: Re: [Catalyst] session in DB example in Catalyst book
> To: "The elegant MVC web framework" 
> Date: Saturday, May 10, 2008, 6:43 PM
> * On Sat, May 10 2008, Andreas Marienborg wrote:
> > On May 10, 2008, at 3:53 AM, Andrew wrote:
> >
> >
> > Using the Rockway's Catalyst book to help
> bring me up to speed on Catalyst
> > and I've got a problem that I can't figure
> out.
> >
> > On page 59, where it uses a database to store the
> session key, I've made
> > all the code changes, but when I start the server
> it gives me the following
> > error:
> >
> > "Couldn't find a model named
> DBIC::Session at /usr/local/share/perl/5.8.8/
> > Catalyst/Plugin/Session/Store/DBIC.pm line 143.
> > Compilation failed in require at
> script/addressbook_server.pl line 53."
> >
> >
> > You don't seem to have the Model you configured
> the session store to use. Do
> > you have the MyApp/Model/DBIC/Session.pm file?
> 
> You shouldn't need that.  The DBIC::Schema model will
> create all the
> classes under the root namespace from the result source
> classes in the
> DBIC schema.
> 
> However, I think the namespace in the book is AddressDB,
> not DBIC.
> 
> Regards,
> Jonathan Rockway
> 
> -- 
> print just => another => perl => hacker => if
> $,=$"
> 
> ___
> List: Catalyst@lists.scsys.co.uk
> Listinfo:
> http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive:
> http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
> Dev site: http://dev.catalyst.perl.org/


  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

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


Re: [Catalyst] session in DB example in Catalyst book

2008-05-10 Thread Jonathan Rockway
* On Sat, May 10 2008, Andreas Marienborg wrote:
> On May 10, 2008, at 3:53 AM, Andrew wrote:
>
>
> Using the Rockway's Catalyst book to help bring me up to speed on Catalyst
> and I've got a problem that I can't figure out.
>
> On page 59, where it uses a database to store the session key, I've made
> all the code changes, but when I start the server it gives me the 
> following
> error:
>
> "Couldn't find a model named DBIC::Session at /usr/local/share/perl/5.8.8/
> Catalyst/Plugin/Session/Store/DBIC.pm line 143.
> Compilation failed in require at script/addressbook_server.pl line 53."
>
>
> You don't seem to have the Model you configured the session store to use. Do
> you have the MyApp/Model/DBIC/Session.pm file?

You shouldn't need that.  The DBIC::Schema model will create all the
classes under the root namespace from the result source classes in the
DBIC schema.

However, I think the namespace in the book is AddressDB, not DBIC.

Regards,
Jonathan Rockway

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

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


Re: [Catalyst] session in DB example in Catalyst book

2008-05-10 Thread Matt S Trout
On Fri, May 09, 2008 at 06:53:47PM -0700, Andrew wrote:
> Using the Rockway's Catalyst book to help bring me up to speed on 
> Catalyst and I've got a problem that I can't figure out.On page 59, 
> where it uses a database to store the session key, I've made all the code 
> changes, but when I start the server it gives me the following 
> error:"Couldn't find a model named DBIC::Session at 
> /usr/local/share/perl/5.8.8/Catalyst/Plugin/Session/Store/DBIC.pm line 
> 143.Compilation failed in require at script/addressbook_server.pl line 
> 53."I've installed Session::Store::DBIC module and even reinstalled 
> it to see if missed out on the Session model and I get the same error.  
> Any ideas?
> 
>   Be a better friend, newshound, and 
> know-it-all with Yahoo! Mobile.  href="http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>  "> Try it now.
> 

You're posting in HTML only.

Fix your mail client.

-- 
  Matt S Trout   Need help with your Catalyst or DBIx::Class project?
   Technical Directorhttp://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/http://www.shadowcat.co.uk/servers/

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


Re: [Catalyst] session in DB example in Catalyst book

2008-05-10 Thread Andrew
The only Session.pm is found in /AddressBook/Schema.  I don't have Models for the People or Addresses that I'm retrieving in this address book example, but I've only got Schemas and Controllers.  The code of /AddressBook/Schema/Session.pm is and as you can see by the package designation Session.pm is suppose to be under the Schema directory and not the Model directory. package AddressBook::Schema::AddressDB::Session;use base qw/DBIx::Class/;__PACKAGE__->load_components(qw/Core/);__PACKAGE__->table('sessions');__PACKAGE__->add_columns(  id =>   { data_type => "CHAR", is_nullable => 0, size => 72 },  session_data => { data_type => "TEXT", is_nullable => 1, size => undef }, 
 expires  => { data_type => "INTEGER", is_nullable => 1, size => undef});__PACKAGE__->set_primary_key('id');1;-- On Fri, 5/9/08, Andreas Marienborg <[EMAIL PROTECTED]> wrote:From: Andreas Marienborg <[EMAIL PROTECTED]>Subject: Re: [Catalyst] session in DB example in Catalyst bookTo: [EMAIL PROTECTED], "The elegant MVC web framework" Date: Friday, May 9, 2008, 10:19 PMOn May 10, 2008, at 3:53 AM, Andrew wrote:Using the Rockway's Catalyst book to help bring me up to speed on Catalyst and I've got a problem that I can't figure out.On page 59, where it uses a database to store the session key, I've made all the code changes, but when I start the server it gives me the following error:"Couldn't find a model named DBIC::Session at /usr/local/share/perl/5.8.8/Catalyst/Plugin/Session/Store/DBIC.pm line 143.Compilation failed in require at script/addressbook_server.pl line 53."You don't seem to have the Model you configured the session store to use. Do you have the MyApp/Model/DBIC/Session.pm file?- andreas

  Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.

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


Re: [Catalyst] session in DB example in Catalyst book

2008-05-09 Thread Andreas Marienborg


On May 10, 2008, at 3:53 AM, Andrew wrote:

Using the Rockway's Catalyst book to help bring me up to speed on  
Catalyst and I've got a problem that I can't figure out.


On page 59, where it uses a database to store the session key, I've  
made all the code changes, but when I start the server it gives me  
the following error:


"Couldn't find a model named DBIC::Session at /usr/local/share/perl/ 
5.8.8/Catalyst/Plugin/Session/Store/DBIC.pm line 143.
Compilation failed in require at script/addressbook_server.pl line  
53."


You don't seem to have the Model you configured the session store to  
use. Do you have the MyApp/Model/DBIC/Session.pm file?



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


Re: [Catalyst] session in DB example in Catalyst book

2008-05-09 Thread Andrew
Got all those resources, checked my code and same thing.--- On Fri, 5/9/08, Kieren Diment <[EMAIL PROTECTED]> wrote:From: Kieren Diment <[EMAIL PROTECTED]>Subject: Re: [Catalyst] session in DB example in Catalyst bookTo: [EMAIL PROTECTED], "The elegant MVC web framework" Date: Friday, May 9, 2008, 7:30 PMOn 10 May 2008, at 11:53, Andrew wrote:> Using the Rockway's Catalyst book to help bring me up to speed on  > Catalyst and I've got a problem that I can't figure out.>> On page 59, where it uses a database to store the session key, I've  > made all the code changes, but when I start the server it gives me  > the following
 error:>> "Couldn't find a model named DBIC::Session at/usr/local/share/perl/ > 5.8.8/Catalyst/Plugin/Session/Store/DBIC.pm line 143.> Compilation failed in require at script/addressbook_server.pl line  > 53.">> I've installed Session::Store::DBIC module and even reinstalled it  > to see if missed out on the Session model and I get the same  > error.  Any ideas?>Two things you need to look at:1.  The example code for the book at:http://jrock.us/Catalyst-Book-Code-20080131.tar.gz2.  The book errata (use the community errata, not the Packt errata)http://catwiki.toeat.com/thebookerrataIf you're still having problems after looking at them thoroughly,  come back and ask more.

  Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.

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


Re: [Catalyst] session in DB example in Catalyst book

2008-05-09 Thread Kieren Diment


On 10 May 2008, at 11:53, Andrew wrote:

Using the Rockway's Catalyst book to help bring me up to speed on  
Catalyst and I've got a problem that I can't figure out.


On page 59, where it uses a database to store the session key, I've  
made all the code changes, but when I start the server it gives me  
the following error:


"Couldn't find a model named DBIC::Session at /usr/local/share/perl/ 
5.8.8/Catalyst/Plugin/Session/Store/DBIC.pm line 143.
Compilation failed in require at script/addressbook_server.pl line  
53."


I've installed Session::Store::DBIC module and even reinstalled it  
to see if missed out on the Session model and I get the same  
error.  Any ideas?




Two things you need to look at:

1.  The example code for the book at:

http://jrock.us/Catalyst-Book-Code-20080131.tar.gz

2.  The book errata (use the community errata, not the Packt errata)

http://catwiki.toeat.com/thebookerrata

If you're still having problems after looking at them thoroughly,  
come back and ask more.


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


[Catalyst] session in DB example in Catalyst book

2008-05-09 Thread Andrew
Using the Rockway's Catalyst book to help bring me up to speed on Catalyst and I've got a problem that I can't figure out.On page 59, where it uses a database to store the session key, I've made all the code changes, but when I start the server it gives me the following error:"Couldn't find a model named DBIC::Session at /usr/local/share/perl/5.8.8/Catalyst/Plugin/Session/Store/DBIC.pm line 143.Compilation failed in require at script/addressbook_server.pl line 53."I've installed Session::Store::DBIC module and even reinstalled it to see if missed out on the Session model and I get the same error.  Any ideas?

  Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.

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