[Catalyst] questions about Hops demo

samwyse samwyse at gmail.com
Thu Jun 16 14:47:36 CEST 2005


I biting off smaller and smaller pieces of Catalyst, hoping to finally
get a piece small enough to wrap my mental jaws around.  So this time,
I went back to Simon's version of the Hops-0.04 example at
http://www.simonf.com/catalyst and installed it, then in a parallel
directory I created a new hops project:

 $ catalyst.pl Hops
 $ cd Hops
 $ sqlite3 /tmp/Hops.db <../hops-sqlite.sql
 $ ln /cygdrive/c/tmp/Hops.db /tmp
 $ script/hops_create.pl model CDBI CDBI dbi:SQLite:/tmp/Hops.db
 $ script/hops_create.pl view TT TT
 $ script/hops_create.pl controller CRUD
 $ cvs import -m "Original source" Catalyst/Hops generated_code start

Then I started making my project's code look like Simon's example
until I got something that worked.  This exercise has taught me a lot,
but left me with a couple of questions:

1)  In catalyst/hops/lib/Hops/M/CDBI.pm, additional classes are loaded
in two different ways:

+ # Declare additional classes.
+ use Class::DBI::Loader::Relationship;
+ use Class::DBI::AsForm;
+ use Class::DBI::FromForm;
+ use Class::DBI::Plugin::RetrieveAll;
+ 
  __PACKAGE__->config(
!     # Declare additional classes.
!     additional_classes => [ qw/
!     	Class::DBI::Plugin::RetrieveAll
! 	Class::DBI::Plugin::AbstractCount
! 	Class::DBI::Plugin::Pager
!     / ],

What's the difference (if any) between these two methods?

2)  Looking at the templates, there's obviously hooks for additional
useful functionality.  For example, when you look at a single beer,
you'd like to see the pubs that serve it.  I'd like to get this
working, but can't figure out how to get $class->meta_info("has_many")
into the template.  Should I be putting something into the stash, or
is there enough stuff there already and I just haven't found it yet?

Thanks!

P.S.  I can post the CVS diffs of my changes to the generated code, if
anyone is interested.  After spending yesterday trying to grok the
templates, I'm back to adding comments to everthing as I figure it
out.



More information about the Catalyst mailing list