[Catalyst] Problem with Catalyst::Manual::Tutorial::CatalystBasics tutorial

Imran Chaudhry electr0sphere at yahoo.co.uk
Tue Apr 10 12:18:17 GMT 2007


Hi all, I'm having a frustrating time trying to debug why the Tutorial
here: http://search.cpan.org/~jrockway/Catalyst-Manual-5.700501/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod
is not working for me.

By "not working" I mean that I do not see the list of books. I get an
empty document.

I've followed the tutorial word for word. My Books.pm controller list
method looks like the following. I have put some debug lines in there
to show where I am:

sub list : Local
{
        # Retrieve the usual perl OO '$self' for this object. $c is the Catalyst
   # 'Context' that's used to 'glue together' the various components
   # that make up the application
        my ($self, $c) = @_;
        # Retrieve all of the book records as book model objects and
store in the
        # stash where they can be accessed by the TT template
        $c->stash->{books} = [$c->model('MyAppDB::Book')->all];

        # it does get the books!
        #print STDERR Dumper($c->stash->{books});

        # Set the TT template to use.  You will almost always want to do this
        # in your action methods (action methods respond to user input in
        # your controllers).
        $c->stash->{template} = 'books/list.tt2';

        # this will contain "books/list.tt2"
        #print STDERR Dumper($c->stash->{template});

   # this does print Foo in the document
   #$c->response->body('Foo');
}

My view class looks like this:

package MyApp::View::TT;

use strict;
use base 'Catalyst::View::TT';

__PACKAGE__->config(
{
   CATALYST_VAR => 'Catalyst',
   INCLUDE_PATH => [
        MyApp->path_to( 'root', 'src' ),
        MyApp->path_to( 'root', 'lib' )
   ],
   PRE_PROCESS  => 'config/main',
   WRAPPER      => 'site/wrapper',
   ERROR        => 'error.tt2',
   TIMER        => 0,
   TEMPLATE_EXTENSION => '.tt2',
        DUMP_CONFIG => 1,
        DEBUG   => 1
}
);


Other facts are that I am running Ubuntu Edgy, I installed the
Catalyst package "libcatalyst-perl" and several others. I am using
MySQL 5.0 as the model store.

Help!

Thanks,
Imran
 
--
"I am because of who you are, and you are because of who I am."
http://www.ubuntulinux.org/




      ___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/ 



More information about the Catalyst mailing list