Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

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'm following the example exactly and 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 got Rockway's tar file with code and I checked that I have all the prerequisite modules installed. Any ideas?
  • Comment on Database, session example in rockway book

Replies are listed 'Best First'.
Re: Database, session example in rockway book
by CountZero (Bishop) on May 11, 2008 at 07:15 UTC
    That is a difficult question to answer: I don't have the Catalyst book and besides, you have "made all the code changes".

    Did you already look at Catalyst/Plugin/Session/Store/DBIC.pm line 143 and see what the offending code is?

    I wild guess: you don't have a module called DBIC::Session or it is not where Perl / Catalyst thinks it should be.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re: Database, session example in rockway book
by grinder (Bishop) on May 11, 2008 at 10:02 UTC

    While your problem does not appear to be listed in the book's errata, a thread about the book would not be complete without a link to the online errata.

    • another intruder with the mooring in the heart of the Perl

Re: Database, session example in rockway book
by dragonchild (Archbishop) on May 11, 2008 at 18:24 UTC
    Have you tried the obvious sudo cpan install DBIC::Session? Just because it's not in the prerequisites doesn't mean it's not required. Even jrockway makes mistakes.

    Update: Use quester's response instead


    My criteria for good software:
    1. Does it work?
    2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
      I think you mean sudo cpan DBIC::Session.

      After the horror several few years back where cpan install actually installed a module called "install"... a big, peculiar module, with odd dependencies... cpan was improved to kick out the following error instead:

      It looks like you specified 'install' as an argument to cpan(1). This script is not the CPAN.pm prompt and doesn't understand the same comma +nds. In fact, doesn't require the extra typing. You probably just want to list the modules you want to install...
        Given that I always do /path/to/perl -MCPAN -e 'install DBIC::Session' (due to the fact that I always have several Perl builds laying about and I like being absolutely sure which one I'm working with), I don't know the actual arguments to the cpan script. :-)

        My criteria for good software:
        1. Does it work?
        2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?