[Catalyst] Quesion about Chaining usage

John Napiorkowski jjn1056 at yahoo.com
Tue Sep 5 16:11:48 CEST 2006


Okay, more info!

I attached a text file which is what I see when
catalyst starts up.  It has the action paths, etc. 
Also I appended to that what I get when I actually try
to run it.  I also attached the actual controller
module that I wrote that is making all this happen,
just in case eyeballing that is useful.

The thing that is weird is that if I just take out all
the PathParts and let the Chain revert to the default
PathPart name it all just works fine, although I don't
get the URLs I want.

Let me know what you think.  I know Chaining is quite
new to Catalyst so maybe best practices are still
emerging.  Personally I really think it's one of the
things that is great about Catalyst, makes it really
appeal to the code idealist in me :)

--john


--- Matt S Trout <dbix-class at trout.me.uk> wrote:

> John Napiorkowski wrote:
> > I've notices what I think is somewhat strange
> behavior
> > in a chain I've created, although as usual it
> might
> > just be my ignorance.  Here's is a skeleton of the
> > chain I made:
> > 
> > package myapp::Controller::Feedrolls
> > 
> > sub feedrolls :Chained('/') CaptureArgs(0){}
> > 
> > sub feedrolls_all :Chained('feedrolls')
> PathPart('')
> > Args(0) {}
> > 
> > sub feedroll :Chained('feedrolls') PathPart('')
> > CaptureArgs(1) { my ($self, $c, $captured) > > 
> > sub feedroll_all :Chained('feedroll') PathPart('')
> > Args(0) {}
> > 
> > When I run catalyst I get a mapping like this:
> > 
> > (1) /feedrolls/*
> > (2) /feedrolls
> > 
> > (1) chains from feedrolls to feedroll to
> feedroll_all
> > and (2) chains from feedrolls to feedrolls_all.
> > 
> > Okay so far so good.  However when I try to call
> the
> > action through the browser at
> > "http://localhost/feedrolls" I get an error about
> the
> > $captured variable being undefined, which is
> strange
> > to me since I am thinking that to get to the
> > containing sub I need to use an action link
> > "/feedrolls/[feedroll_id]".  When I look at the
> debug
> > output to see what is getting called I can see
> that
> > indee that chain is going from feedrolls to
> feedroll
> > to feedroll_all instead of from feedrolls to
> feedrolls
> > all.
> > 
> > What is even stranger is that if I change the sub:
> > 
> > sub feedroll :Chained('feedrolls') PathPart('')
> > CaptureArgs(1) { my ($self, $c, $captured) > > 
> > to 
> > 
> > sub feedroll :Chained('feedrolls') PathPart('')
> > Args(1) { my ($self, $c, $captured) > > 
> > and handle all the processing there instead of the
> way
> > I outlined it above, everything works as expected.
> > 
> > So there seems to be something strange here, since
> > merely terminating the chain one sub earlier
> changes
> > the ways things get called quite a bit.
> > 
> > So... Can anyone spot if there is something wrong
> in
> > the way I am doing this?
> 
> Not without the startup debug output for your app
> showing the path part 
> dispatch table ...
> 
> MORE INFORMATION! MORE INFORMATION! MORE
> INFORMATION!
> 
> (MORE CAFFEINE! :)
> 
> -- 
>       Matt S Trout       Offering custom
> development, consultancy and support
>    Technical Director    contracts for Catalyst,
> DBIx::Class and BAST. Contact
> Shadowcat Systems Ltd.  mst (at)
> shadowcatsystems.co.uk for more information
> 
> + Help us build a better perl ORM:
> http://dbix-class.shadowcatsystems.co.uk/ +
> 
> _______________________________________________
> List: Catalyst at lists.rawmode.org
> Listinfo:
> http://lists.rawmode.org/mailman/listinfo/catalyst
> Searchable archive:
>
http://www.mail-archive.com/catalyst@lists.rawmode.org/
> Dev site: http://dev.catalyst.perl.org/
> 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: debug.txt
Url: http://lists.rawmode.org/pipermail/catalyst/attachments/20060905/eb22d1e2/attachment.txt 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: feedrolls.pm
Type: application/x-perl
Size: 4519 bytes
Desc: 1084352052-feedrolls.pm
Url : http://lists.rawmode.org/pipermail/catalyst/attachments/20060905/eb22d1e2/attachment.bin 


More information about the Catalyst mailing list