[Catalyst] Minor Problem With Tutorial

Kevin Monceaux Kevin at RawFedDogs.net
Tue Aug 15 17:45:44 CEST 2006


Kennedy,

On Mon, Aug 14, 2006 at 04:24:56PM -0400, hkclark at gmail.com wrote:
 
> It has to do with how cpan.org auto-indexes everything.  "Unfortunately",
> the code guys did such a good job that this has been sitting in trunk for
> a while waiting to be released... :-)  Maybe they will find a bug and
> release 5.7002 soon. :-)

I was a little annoyed by the tutorial's link problem at first but after I
found the link to the individual pod files I had no problem creating a local
copy via pod2html.  I'm very impressed with the tutorial.  It covers alot of
ground.  I'm only about half way through it so far.  Thanks to my local copy
I was able to figure out the proper links to the individual sections of the
online version.  For those that haven't figured it out yet:

http://search.cpan.org/~mramberg/Catalyst-Runtime-5.7001/lib/Catalyst/Manual/Tutorial/Intro.pod

will get you to the Intro section, and the links to the other sections of
the tutorial work from that page.

> Re the forward issue... I would need to take a closer look to comment.
> Let me know if you are still having problems and we can figure it out.

The tutorial at the above link doesn't appear to have the problem.  I'm just
digging into Catalyst but thanks to the very helpful replies I received to
my initial post I think I understand the root of the problem.  So, I'll take
a stab at summarizing it and hopefully someone will jump in and correct me
if I completely smeg up the summary.  The latest version of the Catalyst
Basics tutorial at:

http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Runtime/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod

has a "USING THE DEFAULT TEMPLATE NAME" section in which the user is
instructed to remove the:

$c->stash->{template} = 'books/list.tt2';

statement from the Books controller's list method.  In the next section
of the tutorial a simple delete method is added.  After it deletes a book it
tries to redirect the user to the list method via:

$c->forward('list');

Which executes the list method in the Books controller, then returns to the
delete method and falls through to the various end methods and eventually
the DefaultEnd or RenderView method gets executed.  So, if a template hasn't
been explicitly set the template name defaults to books/delete.tt2, not the
books/list.tt2.  There might be more than one solution to the problem.  One
could add the:

$c->stash->{template} = 'books/list.tt2';

statement back to the Books controller's list method or perhaps could set
the template name in the delete method.  Right around the point in the
tutorial where the delete method is added might be a good place to discuss
when/where using the default template name won't work.  Someone suggested
using $c->detach('list') instead of $c->forward('list').  I tried that.
When using $c->detach('list') from the delete method the template name still
appears to default to books/delete.tt2.


Kevin
http://www.RawFedDogs.net
http://www.WacoAgilityGroup.org
Bruceville, TX

Si hoc legere scis nimium eruditionis habes.



More information about the Catalyst mailing list